mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
use a local copy of repoq so we don't inadvertently pollute the one for is_installed
This commit is contained in:
parent
1c067845f2
commit
808554dee6
1 changed files with 14 additions and 11 deletions
25
library/yum
25
library/yum
|
@ -168,15 +168,17 @@ def is_available(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_
|
|||
return [ po_to_nevra(p) for p in pkgs ]
|
||||
|
||||
else:
|
||||
myrepoq = list(repoq)
|
||||
|
||||
for repoid in en_repos:
|
||||
r_cmd = ['--enablerepo', repoid]
|
||||
repoq.extend(r_cmd)
|
||||
myrepoq.extend(r_cmd)
|
||||
|
||||
for repoid in dis_repos:
|
||||
r_cmd = ['--disablerepo', repoid]
|
||||
repoq.extend(r_cmd)
|
||||
myrepoq.extend(r_cmd)
|
||||
|
||||
cmd = repoq + ["--qf", qf, pkgspec]
|
||||
cmd = myrepoq + ["--qf", qf, pkgspec]
|
||||
rc,out,err = module.run_command(cmd)
|
||||
if rc == 0:
|
||||
return [ p for p in out.split('\n') if p.strip() ]
|
||||
|
@ -216,16 +218,17 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_rep
|
|||
return set([ po_to_nevra(p) for p in retpkgs ])
|
||||
|
||||
else:
|
||||
myrepoq = list(repoq)
|
||||
for repoid in en_repos:
|
||||
r_cmd = ['--enablerepo', repoid]
|
||||
repoq.extend(r_cmd)
|
||||
myrepoq.extend(r_cmd)
|
||||
|
||||
for repoid in dis_repos:
|
||||
r_cmd = ['--disablerepo', repoid]
|
||||
repoq.extend(r_cmd)
|
||||
myrepoq.extend(r_cmd)
|
||||
|
||||
|
||||
cmd = repoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec]
|
||||
cmd = myrepoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec]
|
||||
rc,out,err = module.run_command(cmd)
|
||||
|
||||
if rc == 0:
|
||||
|
@ -261,18 +264,18 @@ def what_provides(module, repoq, req_spec, conf_file, qf=def_qf, en_repos=[], d
|
|||
return set([ po_to_nevra(p) for p in pkgs ])
|
||||
|
||||
else:
|
||||
|
||||
myrepoq = list(repoq)
|
||||
for repoid in en_repos:
|
||||
r_cmd = ['--enablerepo', repoid]
|
||||
repoq.extend(r_cmd)
|
||||
myrepoq.extend(r_cmd)
|
||||
|
||||
for repoid in dis_repos:
|
||||
r_cmd = ['--disablerepo', repoid]
|
||||
repoq.extend(r_cmd)
|
||||
myrepoq.extend(r_cmd)
|
||||
|
||||
cmd = repoq + ["--qf", qf, "--whatprovides", req_spec]
|
||||
cmd = myrepoq + ["--qf", qf, "--whatprovides", req_spec]
|
||||
rc,out,err = module.run_command(cmd)
|
||||
cmd = repoq + ["--qf", qf, req_spec]
|
||||
cmd = myrepoq + ["--qf", qf, req_spec]
|
||||
rc2,out2,err2 = module.run_command(cmd)
|
||||
if rc == 0 and rc2 == 0:
|
||||
out += out2
|
||||
|
|
Loading…
Reference in a new issue