c['workers'] = []
NetLocks = dict()
+def ini_parse_workers(section):
+ name = section.get("name")
+ password = section.get("password")
+ phase = section.getint("phase")
+
+ if not name or not password or not phase == 1:
+ log.msg("invalid worker configuration ignored: {}".format(repr(section)))
+ return
+
+ sl_props = { 'dl_lock':None, 'ul_lock':None }
+ if "dl_lock" in section:
+ lockname = section.get("dl_lock")
+ sl_props['dl_lock'] = lockname
+ if lockname not in NetLocks:
+ NetLocks[lockname] = locks.MasterLock(lockname)
+ if "ul_lock" in section:
+ lockname = section.get("ul_lock")
+ sl_props['ul_lock'] = lockname
+ if lockname not in NetLocks:
+ NetLocks[lockname] = locks.MasterLock(lockname)
+
+ log.msg("Configured worker: {}".format(name))
+ c['workers'].append(Worker(name, password, max_builds = 1, properties = sl_props))
+
+
for section in ini.sections():
if section.startswith("branch "):
ini_parse_branch(ini[section])
if section.startswith("worker "):
- if ini.has_option(section, "name") and ini.has_option(section, "password") and \
- (not ini.has_option(section, "phase") or ini.getint(section, "phase") == 1):
- sl_props = { 'dl_lock':None, 'ul_lock':None }
- name = ini.get(section, "name")
- password = ini.get(section, "password")
- if ini.has_option(section, "dl_lock"):
- lockname = ini.get(section, "dl_lock")
- sl_props['dl_lock'] = lockname
- if lockname not in NetLocks:
- NetLocks[lockname] = locks.MasterLock(lockname)
- if ini.has_option(section, "ul_lock"):
- lockname = ini.get(section, "ul_lock")
- sl_props['ul_lock'] = lockname
- if lockname not in NetLocks:
- NetLocks[lockname] = locks.MasterLock(lockname)
- c['workers'].append(Worker(name, password, max_builds = 1, properties = sl_props))
+ ini_parse_workers(ini[section])
+
+branchNames = [branches[b]["name"] for b in branches]
c['protocols'] = {'pb': {'port': pb_port}}
####### CHANGESOURCES
-branchNames = [branches[b]["name"] for b in branches]
-
# find targets
targets = set()