diff options
author | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2011-09-15 12:55:55 +0300 |
---|---|---|
committer | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2011-09-15 12:55:55 +0300 |
commit | a03c02fce91c115a15f42dd73bb059cc761415e2 (patch) | |
tree | a708620116352afa7b67e109a0381fabc35a430e /control | |
parent | b4681a30957e35da642210dac7dd6983e34355ea (diff) |
Add main() function.
Diffstat (limited to 'control')
-rwxr-xr-x | control/mangle-jobs | 36 |
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() |