aboutsummaryrefslogtreecommitdiff
path: root/control
diff options
context:
space:
mode:
Diffstat (limited to 'control')
-rwxr-xr-xcontrol/mangle-jobs36
1 files changed, 20 insertions, 16 deletions
diff --git a/control/mangle-jobs b/control/mangle-jobs
index 010b91d..2bd9717 100755
--- a/control/mangle-jobs
+++ b/control/mangle-jobs
@@ -79,19 +79,23 @@ def show_diff(old, new):
os.system('diff -u %s %s' % (a.name, b.name))
print
-jobs = json.load(urllib2.urlopen('http://localhost:9090/jenkins/api/json?tree=jobs[name]'))
-names = [job['name'] for job in jobs['jobs']]
-names = [name for name in names if name == 'blank' or '_' in name]
-for name in names:
- if limit == 0:
- break
- limit -= 1
- print "Processing:" + name
- text = getJobConfig(name)
- tree = fromstring(text)
- mangler(tree)
- new_text = tostring(tree, xml_declaration=True, encoding='UTF-8')
- if not options.really:
- show_diff(text, new_text)
- else:
- postConfig('job/' + name + '/config.xml', new_text)
+def main():
+ jobs = json.load(urllib2.urlopen('http://localhost:9090/jenkins/api/json?tree=jobs[name]'))
+ names = [job['name'] for job in jobs['jobs']]
+ names = [name for name in names if name == 'blank' or '_' in name]
+ for name in names:
+ if limit == 0:
+ break
+ limit -= 1
+ print "Processing:" + name
+ text = getJobConfig(name)
+ tree = fromstring(text)
+ mangler(tree)
+ new_text = tostring(tree, xml_declaration=True, encoding='UTF-8')
+ if not options.really:
+ show_diff(text, new_text)
+ else:
+ postConfig('job/' + name + '/config.xml', new_text)
+
+if __name__ == "__main__":
+ main()