mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #6208 from jctanner/yum-rhn-fix
Fixes #6205 Add install_repoquery parameter to the yum module
This commit is contained in:
commit
f95786b52d
1 changed files with 17 additions and 0 deletions
|
@ -94,6 +94,7 @@ options:
|
||||||
default: "no"
|
default: "no"
|
||||||
choices: ["yes", "no"]
|
choices: ["yes", "no"]
|
||||||
aliases: []
|
aliases: []
|
||||||
|
|
||||||
notes: []
|
notes: []
|
||||||
# informational: requirements for nodes
|
# informational: requirements for nodes
|
||||||
requirements: [ yum, rpm ]
|
requirements: [ yum, rpm ]
|
||||||
|
@ -154,6 +155,17 @@ def yum_base(conf_file=None, cachedir=False):
|
||||||
|
|
||||||
return my
|
return my
|
||||||
|
|
||||||
|
def install_yum_utils(module):
|
||||||
|
|
||||||
|
if not module.check_mode:
|
||||||
|
yum_path = module.get_bin_path('yum')
|
||||||
|
if yum_path:
|
||||||
|
rc, so, se = module.run_command('%s -y install yum-utils' % yum_path)
|
||||||
|
if rc == 0:
|
||||||
|
this_path = module.get_bin_path('repoquery')
|
||||||
|
global repoquery
|
||||||
|
repoquery = this_path
|
||||||
|
|
||||||
def po_to_nevra(po):
|
def po_to_nevra(po):
|
||||||
|
|
||||||
if hasattr(po, 'ui_nevra'):
|
if hasattr(po, 'ui_nevra'):
|
||||||
|
@ -789,13 +801,18 @@ def main():
|
||||||
list=dict(),
|
list=dict(),
|
||||||
conf_file=dict(default=None),
|
conf_file=dict(default=None),
|
||||||
disable_gpg_check=dict(required=False, default="no", type='bool'),
|
disable_gpg_check=dict(required=False, default="no", type='bool'),
|
||||||
|
# this should not be needed, but exists as a failsafe
|
||||||
|
install_repoquery=dict(required=False, default="yes", type='bool'),
|
||||||
),
|
),
|
||||||
required_one_of = [['name','list']],
|
required_one_of = [['name','list']],
|
||||||
mutually_exclusive = [['name','list']],
|
mutually_exclusive = [['name','list']],
|
||||||
supports_check_mode = True
|
supports_check_mode = True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# this should not be needed, but exists as a failsafe
|
||||||
params = module.params
|
params = module.params
|
||||||
|
if params['install_repoquery'] and not repoquery and not module.check_mode:
|
||||||
|
install_yum_utils(module)
|
||||||
|
|
||||||
if params['list']:
|
if params['list']:
|
||||||
if not repoquery:
|
if not repoquery:
|
||||||
|
|
Loading…
Reference in a new issue