From f65df5f62af97d4c63a2c32d137223e2032e6acc Mon Sep 17 00:00:00 2001 From: tgates81 <31669870+tgates81@users.noreply.github.com> Date: Fri, 25 May 2018 09:58:35 -0400 Subject: [PATCH] yum.py module: added option for yum --bugfix updates. (#36203) --- lib/ansible/modules/packaging/os/yum.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/packaging/os/yum.py b/lib/ansible/modules/packaging/os/yum.py index a4c6d6e5836..c5a6173b1e2 100644 --- a/lib/ansible/modules/packaging/os/yum.py +++ b/lib/ansible/modules/packaging/os/yum.py @@ -116,6 +116,12 @@ options: type: bool default: "no" version_added: "2.4" + bugfix: + description: + - If set to C(yes), and C(state=latest) then only installs updates that have been marked bugfix related. + required: false + default: "no" + version_added: "2.6" allow_downgrade: description: - Specify if the named package and version is allowed to downgrade @@ -1272,7 +1278,7 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, en def ensure(module, state, pkgs, conf_file, enablerepo, disablerepo, disable_gpg_check, exclude, repoq, skip_broken, update_only, security, - installroot='/', allow_downgrade=False, disable_plugin=None, enable_plugin=None): + bugfix, installroot='/', allow_downgrade=False, disable_plugin=None, enable_plugin=None): # fedora will redirect yum to dnf, which has incompatibilities # with how this module expects yum to operate. If yum-deprecated @@ -1382,6 +1388,8 @@ def ensure(module, state, pkgs, conf_file, enablerepo, disablerepo, yum_basecmd.append('--nogpgcheck') if security: yum_basecmd.append('--security') + if bugfix: + yum_basecmd.append('--bugfix') res = latest(module, pkgs, repoq, yum_basecmd, conf_file, en_repos, dis_repos, enable_plugin, disable_plugin, update_only, installroot=installroot) else: # should be caught by AnsibleModule argument_spec @@ -1422,6 +1430,7 @@ def main(): install_repoquery=dict(type='bool', default=True), allow_downgrade=dict(type='bool', default=False), security=dict(type='bool', default=False), + bugfix=dict(required=False, type='bool', default=False), enable_plugin=dict(type='list', default=[]), disable_plugin=dict(type='list', default=[]), ), @@ -1481,10 +1490,11 @@ def main(): skip_broken = params['skip_broken'] update_only = params['update_only'] security = params['security'] + bugfix = params['bugfix'] allow_downgrade = params['allow_downgrade'] results = ensure(module, state, pkg, params['conf_file'], enablerepo, disablerepo, disable_gpg_check, exclude, repoquery, - skip_broken, update_only, security, params['installroot'], allow_downgrade, + skip_broken, update_only, security, bugfix, params['installroot'], allow_downgrade, disable_plugin=disable_plugin, enable_plugin=enable_plugin) if repoquery: results['msg'] = '%s %s' % (