make it output number of pkgs neeed to be updated per host
This commit is contained in:
parent
33d9363211
commit
90d3275e54
|
@ -24,9 +24,10 @@ def main(args):
|
|||
parser.add_option('--host', dest='hostlist', action='append',
|
||||
help="hosts to contact, defaults to all in your inventory", default=[])
|
||||
options, args = parser.parse_args(args)
|
||||
options.module_name = 'shell'
|
||||
options.module_args = 'yum check-update > /dev/null'
|
||||
|
||||
options.module_name = 'yum'
|
||||
options.module_args = 'list=updates'
|
||||
|
||||
|
||||
# no hosts specified? Run against all of them
|
||||
if not options.hostlist:
|
||||
options.pattern = 'all'
|
||||
|
@ -53,11 +54,10 @@ def main(args):
|
|||
needsupdate = []
|
||||
results = runner.run()
|
||||
for (host,d) in results['contacted'].items():
|
||||
answer = d.get('rc', '0')
|
||||
if answer == 100:
|
||||
needsupdate.append(host)
|
||||
elif answer == 0:
|
||||
pass
|
||||
answer = d.get('results', [])
|
||||
if answer:
|
||||
needsupdate.append('%s : %s' % (host, len(answer)))
|
||||
|
||||
else:
|
||||
if d.get('failed', False):
|
||||
err = d.get('stderr', '').strip()
|
||||
|
|
Loading…
Reference in New Issue