phase1: move do_cleanup to slave properties
authorThibaut VARÈNE <hacks@slashdirt.org>
Fri, 22 Jun 2018 12:25:17 +0000 (14:25 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 26 Jun 2018 20:08:56 +0000 (22:08 +0200)
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
phase1/master.cfg

index b4da1ad321a3c074650cb41d52a32271dc63957c..a4e21da858a09ec69b5b827f7c0706d906113f9c 100644 (file)
@@ -49,21 +49,19 @@ if ini.has_option("general", "port"):
 
 c['slaves'] = []
 max_builds = dict()
-do_cleanup = dict()
 NetLocks = dict()
 
 for section in ini.sections():
        if section.startswith("slave "):
                if ini.has_option(section, "name") and ini.has_option(section, "password"):
-                       sl_props = { 'dl_lock':None, 'ul_lock':None, }
+                       sl_props = { 'dl_lock':None, 'ul_lock':None, 'do_cleanup':False }
                        name = ini.get(section, "name")
                        password = ini.get(section, "password")
                        max_builds[name] = 1
-                       do_cleanup[name] = False
                        if ini.has_option(section, "builds"):
                                max_builds[name] = ini.getint(section, "builds")
                        if ini.has_option(section, "cleanup"):
-                               do_cleanup[name] = ini.getboolean(section, "cleanup")
+                               sl_props['do_cleanup'] = ini.getboolean(section, "cleanup")
                        if ini.has_option(section, "dl_lock"):
                                lockname = ini.get(section, "dl_lock")
                                sl_props['dl_lock'] = lockname
@@ -230,8 +228,8 @@ def IsMakeCleanRequested(pattern):
        return CheckCleanProperty
 
 def IsCleanupRequested(step):
-       val = step.getProperty("slavename")
-       if val and do_cleanup[val]:
+       do_cleanup = step.getProperty("do_cleanup")
+       if do_cleanup:
                return True
        else:
                return False
@@ -253,9 +251,9 @@ def IsNoMasterBuild(step):
        return repo_branch != "master"
 
 def IsCleanupConfigured(step):
-       slave = step.getProperty("slavename")
-       if slave and slave in do_cleanup:
-               return do_cleanup[slave] > 0
+       do_cleanup = step.getProperty("do_cleanup")
+       if do_cleanup:
+               return do_cleanup > 0
        else:
                return False