From 7216a2b169bdb0efc70efc532e9beef0e94f85be Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Thu, 4 Jul 2013 22:13:46 -0400 Subject: [PATCH] add a '*' option for name to state=latest to do a global update --- library/packaging/yum | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/library/packaging/yum b/library/packaging/yum index eb8a40d7956..43888133db2 100644 --- a/library/packaging/yum +++ b/library/packaging/yum @@ -544,9 +544,20 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos): pkg = None basecmd = 'update' + cmd = '' # groups, again if spec.startswith('@'): 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 else: 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 pkg = spec - - cmd = yum_basecmd + [basecmd, pkg] + if not cmd: + cmd = yum_basecmd + [basecmd, pkg] if module.check_mode: return module.exit_json(changed=True)