yum.py module: added option for yum --bugfix updates. (#36203)

pull/40718/head
tgates81 7 years ago committed by ansibot
parent 1d5fe326e8
commit f65df5f62a

@ -116,6 +116,12 @@ options:
type: bool type: bool
default: "no" default: "no"
version_added: "2.4" 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: allow_downgrade:
description: description:
- Specify if the named package and version is allowed to downgrade - 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, def ensure(module, state, pkgs, conf_file, enablerepo, disablerepo,
disable_gpg_check, exclude, repoq, skip_broken, update_only, security, 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 # fedora will redirect yum to dnf, which has incompatibilities
# with how this module expects yum to operate. If yum-deprecated # 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') yum_basecmd.append('--nogpgcheck')
if security: if security:
yum_basecmd.append('--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) res = latest(module, pkgs, repoq, yum_basecmd, conf_file, en_repos, dis_repos, enable_plugin, disable_plugin, update_only, installroot=installroot)
else: else:
# should be caught by AnsibleModule argument_spec # should be caught by AnsibleModule argument_spec
@ -1422,6 +1430,7 @@ def main():
install_repoquery=dict(type='bool', default=True), install_repoquery=dict(type='bool', default=True),
allow_downgrade=dict(type='bool', default=False), allow_downgrade=dict(type='bool', default=False),
security=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=[]), enable_plugin=dict(type='list', default=[]),
disable_plugin=dict(type='list', default=[]), disable_plugin=dict(type='list', default=[]),
), ),
@ -1481,10 +1490,11 @@ def main():
skip_broken = params['skip_broken'] skip_broken = params['skip_broken']
update_only = params['update_only'] update_only = params['update_only']
security = params['security'] security = params['security']
bugfix = params['bugfix']
allow_downgrade = params['allow_downgrade'] allow_downgrade = params['allow_downgrade']
results = ensure(module, state, pkg, params['conf_file'], enablerepo, results = ensure(module, state, pkg, params['conf_file'], enablerepo,
disablerepo, disable_gpg_check, exclude, repoquery, 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) disable_plugin=disable_plugin, enable_plugin=enable_plugin)
if repoquery: if repoquery:
results['msg'] = '%s %s' % ( results['msg'] = '%s %s' % (

Loading…
Cancel
Save