mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fixes #5255 yum: set disabled repos before enabled repos and fix the parameters used
This commit is contained in:
parent
86d8c58bd2
commit
0cca4a3919
1 changed files with 16 additions and 17 deletions
|
@ -224,14 +224,14 @@ def is_available(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_
|
||||||
else:
|
else:
|
||||||
myrepoq = list(repoq)
|
myrepoq = list(repoq)
|
||||||
|
|
||||||
for repoid in en_repos:
|
|
||||||
r_cmd = ['--enablerepo', repoid]
|
|
||||||
myrepoq.extend(r_cmd)
|
|
||||||
|
|
||||||
for repoid in dis_repos:
|
for repoid in dis_repos:
|
||||||
r_cmd = ['--disablerepo', repoid]
|
r_cmd = ['--disablerepo', repoid]
|
||||||
myrepoq.extend(r_cmd)
|
myrepoq.extend(r_cmd)
|
||||||
|
|
||||||
|
for repoid in en_repos:
|
||||||
|
r_cmd = ['--enablerepo', repoid]
|
||||||
|
myrepoq.extend(r_cmd)
|
||||||
|
|
||||||
cmd = myrepoq + ["--qf", qf, pkgspec]
|
cmd = myrepoq + ["--qf", qf, pkgspec]
|
||||||
rc,out,err = module.run_command(cmd)
|
rc,out,err = module.run_command(cmd)
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
|
@ -273,14 +273,13 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_rep
|
||||||
|
|
||||||
else:
|
else:
|
||||||
myrepoq = list(repoq)
|
myrepoq = list(repoq)
|
||||||
for repoid in en_repos:
|
|
||||||
r_cmd = ['--enablerepo', repoid]
|
|
||||||
myrepoq.extend(r_cmd)
|
|
||||||
|
|
||||||
for repoid in dis_repos:
|
for repoid in dis_repos:
|
||||||
r_cmd = ['--disablerepo', repoid]
|
r_cmd = ['--disablerepo', repoid]
|
||||||
myrepoq.extend(r_cmd)
|
myrepoq.extend(r_cmd)
|
||||||
|
|
||||||
|
for repoid in en_repos:
|
||||||
|
r_cmd = ['--enablerepo', repoid]
|
||||||
|
myrepoq.extend(r_cmd)
|
||||||
|
|
||||||
cmd = myrepoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec]
|
cmd = myrepoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec]
|
||||||
rc,out,err = module.run_command(cmd)
|
rc,out,err = module.run_command(cmd)
|
||||||
|
@ -319,14 +318,14 @@ def what_provides(module, repoq, req_spec, conf_file, qf=def_qf, en_repos=[], d
|
||||||
|
|
||||||
else:
|
else:
|
||||||
myrepoq = list(repoq)
|
myrepoq = list(repoq)
|
||||||
for repoid in en_repos:
|
|
||||||
r_cmd = ['--enablerepo', repoid]
|
|
||||||
myrepoq.extend(r_cmd)
|
|
||||||
|
|
||||||
for repoid in dis_repos:
|
for repoid in dis_repos:
|
||||||
r_cmd = ['--disablerepo', repoid]
|
r_cmd = ['--disablerepo', repoid]
|
||||||
myrepoq.extend(r_cmd)
|
myrepoq.extend(r_cmd)
|
||||||
|
|
||||||
|
for repoid in en_repos:
|
||||||
|
r_cmd = ['--enablerepo', repoid]
|
||||||
|
myrepoq.extend(r_cmd)
|
||||||
|
|
||||||
cmd = myrepoq + ["--qf", qf, "--whatprovides", req_spec]
|
cmd = myrepoq + ["--qf", qf, "--whatprovides", req_spec]
|
||||||
rc,out,err = module.run_command(cmd)
|
rc,out,err = module.run_command(cmd)
|
||||||
cmd = myrepoq + ["--qf", qf, req_spec]
|
cmd = myrepoq + ["--qf", qf, req_spec]
|
||||||
|
@ -724,12 +723,12 @@ def ensure(module, state, pkgspec, conf_file, enablerepo, disablerepo,
|
||||||
if enablerepo:
|
if enablerepo:
|
||||||
en_repos = enablerepo.split(',')
|
en_repos = enablerepo.split(',')
|
||||||
|
|
||||||
for repoid in en_repos:
|
for repoid in dis_repos:
|
||||||
r_cmd = ['--enablerepo', repoid]
|
r_cmd = ['--disablerepo=%s' % repoid]
|
||||||
yum_basecmd.extend(r_cmd)
|
yum_basecmd.extend(r_cmd)
|
||||||
|
|
||||||
for repoid in dis_repos:
|
for repoid in en_repos:
|
||||||
r_cmd = ['--disablerepo', repoid]
|
r_cmd = ['--enablerepo=%s' % repoid]
|
||||||
yum_basecmd.extend(r_cmd)
|
yum_basecmd.extend(r_cmd)
|
||||||
|
|
||||||
if state in ['installed', 'present', 'latest']:
|
if state in ['installed', 'present', 'latest']:
|
||||||
|
|
Loading…
Reference in a new issue