mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
add a '*' option for name to state=latest to do a global update
This commit is contained in:
parent
27fcfe9cac
commit
7216a2b169
1 changed files with 13 additions and 2 deletions
|
@ -544,9 +544,20 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
|
||||||
|
|
||||||
pkg = None
|
pkg = None
|
||||||
basecmd = 'update'
|
basecmd = 'update'
|
||||||
|
cmd = ''
|
||||||
# groups, again
|
# groups, again
|
||||||
if spec.startswith('@'):
|
if spec.startswith('@'):
|
||||||
pkg = spec
|
pkg = spec
|
||||||
|
|
||||||
|
elif spec == '*': #update all
|
||||||
|
# use check-update to see if there is any need
|
||||||
|
rc,out,err = module.run_command(yum_basecmd + ['check-update'])
|
||||||
|
if rc == 100:
|
||||||
|
cmd = yum_basecmd + [basecmd]
|
||||||
|
else:
|
||||||
|
res['results'].append('All packages up to date')
|
||||||
|
continue
|
||||||
|
|
||||||
# dep/pkgname - find it
|
# dep/pkgname - find it
|
||||||
else:
|
else:
|
||||||
if is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos):
|
if is_installed(module, repoq, spec, conf_file, en_repos=en_repos, dis_repos=dis_repos):
|
||||||
|
@ -574,8 +585,8 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
pkg = spec
|
pkg = spec
|
||||||
|
if not cmd:
|
||||||
cmd = yum_basecmd + [basecmd, pkg]
|
cmd = yum_basecmd + [basecmd, pkg]
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
return module.exit_json(changed=True)
|
return module.exit_json(changed=True)
|
||||||
|
|
Loading…
Reference in a new issue