diff options
| author | Seth Vidal <skvidal@fedoraproject.org> | 2013-06-03 22:19:01 +0000 |
|---|---|---|
| committer | Seth Vidal <skvidal@fedoraproject.org> | 2013-06-03 22:19:01 +0000 |
| commit | e9e5208be6ccc6c87be00adc8042e5d01e37284e (patch) | |
| tree | b65008c97cbe0a6b89fe84b1bd3da72100658d57 /scripts/builders | |
| parent | a73047871c825065b71033639e9006f9aa71b160 (diff) | |
add builders/isbuilding and installedon scripts to ansible scripts
Diffstat (limited to 'scripts/builders')
| -rwxr-xr-x | scripts/builders/isbuilding | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/builders/isbuilding b/scripts/builders/isbuilding new file mode 100755 index 000000000..616ce73e2 --- /dev/null +++ b/scripts/builders/isbuilding @@ -0,0 +1,41 @@ +#!/usr/bin/python -tt + +import ansible +import ansible.runner +import sys + + + + +def isbuilding(res, host): + if res['contacted'][host]['stdout'].strip() == 'none': + return False + else: + return True + + +pattern = 'builders' +if len(sys.argv) > 1: + pattern=';'.join(sys.argv[1:]) + +conn = ansible.runner.Runner(pattern=pattern, timeout=20, forks=30, remote_user='root') +conn.module_name='shell' +# this checks koji building or anything running as mock or mockbuilder +# first part check if kojid has any child processes +# second part is our catch for failure +# third part is to see if anything is running as mock or mockbuilder +conn.module_args="ps -opid= --ppid $(pidof -s -x kojid) || echo -n none || ps -u mock -u mockbuilder -opid=" +res = conn.run() + +for host in sorted(res['dark'].keys() + res['contacted'].keys()): + print host, + if host in res['dark']: + print ' down' + else: + if isbuilding(res, host): + print ' yes' + else: + print ' no' + + + |
