From 0cca4a3919ade2058dc17f16b3fc35c568e0824f Mon Sep 17 00:00:00 2001 From: James Tanner Date: Tue, 25 Feb 2014 14:52:45 -0500 Subject: [PATCH] Fixes #5255 yum: set disabled repos before enabled repos and fix the parameters used --- library/packaging/yum | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/library/packaging/yum b/library/packaging/yum index 4d72a34b21..11d9bfcc3e 100644 --- a/library/packaging/yum +++ b/library/packaging/yum @@ -223,14 +223,14 @@ def is_available(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_ else: myrepoq = list(repoq) + + for repoid in dis_repos: + r_cmd = ['--disablerepo', repoid] + myrepoq.extend(r_cmd) for repoid in en_repos: r_cmd = ['--enablerepo', repoid] myrepoq.extend(r_cmd) - - for repoid in dis_repos: - r_cmd = ['--disablerepo', repoid] - myrepoq.extend(r_cmd) cmd = myrepoq + ["--qf", qf, pkgspec] rc,out,err = module.run_command(cmd) @@ -273,14 +273,13 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_rep else: myrepoq = list(repoq) - for repoid in en_repos: - r_cmd = ['--enablerepo', repoid] - myrepoq.extend(r_cmd) - for repoid in dis_repos: r_cmd = ['--disablerepo', repoid] myrepoq.extend(r_cmd) + for repoid in en_repos: + r_cmd = ['--enablerepo', repoid] + myrepoq.extend(r_cmd) cmd = myrepoq + ["--pkgnarrow=updates", "--qf", qf, pkgspec] 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: myrepoq = list(repoq) - for repoid in en_repos: - r_cmd = ['--enablerepo', repoid] - myrepoq.extend(r_cmd) - for repoid in dis_repos: r_cmd = ['--disablerepo', repoid] myrepoq.extend(r_cmd) + for repoid in en_repos: + r_cmd = ['--enablerepo', repoid] + myrepoq.extend(r_cmd) + cmd = myrepoq + ["--qf", qf, "--whatprovides", req_spec] rc,out,err = module.run_command(cmd) cmd = myrepoq + ["--qf", qf, req_spec] @@ -723,13 +722,13 @@ def ensure(module, state, pkgspec, conf_file, enablerepo, disablerepo, dis_repos = disablerepo.split(',') if enablerepo: en_repos = enablerepo.split(',') + + for repoid in dis_repos: + r_cmd = ['--disablerepo=%s' % repoid] + yum_basecmd.extend(r_cmd) for repoid in en_repos: - r_cmd = ['--enablerepo', repoid] - yum_basecmd.extend(r_cmd) - - for repoid in dis_repos: - r_cmd = ['--disablerepo', repoid] + r_cmd = ['--enablerepo=%s' % repoid] yum_basecmd.extend(r_cmd) if state in ['installed', 'present', 'latest']: