Merge pull request #46 from Jmainguy/yum_oracle_fix_enable_repo
Fixes --enable-repo for Oracle Linux
This commit is contained in:
commit
600fc15b42
1 changed files with 21 additions and 31 deletions
|
@ -243,13 +243,11 @@ 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 dis_repos:
|
r_cmd = ['--disablerepo', ','.join(dis_repos)]
|
||||||
r_cmd = ['--disablerepo', repoid]
|
myrepoq.extend(r_cmd)
|
||||||
myrepoq.extend(r_cmd)
|
|
||||||
|
|
||||||
for repoid in en_repos:
|
r_cmd = ['--enablerepo', ','.join(en_repos)]
|
||||||
r_cmd = ['--enablerepo', repoid]
|
myrepoq.extend(r_cmd)
|
||||||
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)
|
||||||
|
@ -292,13 +290,11 @@ 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 dis_repos:
|
r_cmd = ['--disablerepo', ','.join(dis_repos)]
|
||||||
r_cmd = ['--disablerepo', repoid]
|
myrepoq.extend(r_cmd)
|
||||||
myrepoq.extend(r_cmd)
|
|
||||||
|
|
||||||
for repoid in en_repos:
|
r_cmd = ['--enablerepo', ','.join(en_repos)]
|
||||||
r_cmd = ['--enablerepo', repoid]
|
myrepoq.extend(r_cmd)
|
||||||
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)
|
||||||
|
@ -337,13 +333,11 @@ 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 dis_repos:
|
r_cmd = ['--disablerepo', ','.join(dis_repos)]
|
||||||
r_cmd = ['--disablerepo', repoid]
|
myrepoq.extend(r_cmd)
|
||||||
myrepoq.extend(r_cmd)
|
|
||||||
|
|
||||||
for repoid in en_repos:
|
r_cmd = ['--enablerepo', ','.join(en_repos)]
|
||||||
r_cmd = ['--enablerepo', repoid]
|
myrepoq.extend(r_cmd)
|
||||||
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)
|
||||||
|
@ -683,7 +677,7 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
|
||||||
nothing_to_do = False
|
nothing_to_do = False
|
||||||
break
|
break
|
||||||
|
|
||||||
if basecmd == 'update' and is_update(module, repoq, this, conf_file, en_repos=en_repos, dis_repos=dis_repos):
|
if basecmd == 'update' and is_update(module, repoq, this, conf_file, en_repos=en_repos, dis_repos=en_repos):
|
||||||
nothing_to_do = False
|
nothing_to_do = False
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -745,16 +739,14 @@ def ensure(module, state, pkgspec, conf_file, enablerepo, disablerepo,
|
||||||
en_repos = []
|
en_repos = []
|
||||||
if disablerepo:
|
if disablerepo:
|
||||||
dis_repos = disablerepo.split(',')
|
dis_repos = disablerepo.split(',')
|
||||||
|
r_cmd = ['--disablerepo=%s' % disablerepo]
|
||||||
|
yum_basecmd.extend(r_cmd)
|
||||||
if enablerepo:
|
if enablerepo:
|
||||||
en_repos = enablerepo.split(',')
|
en_repos = enablerepo.split(',')
|
||||||
|
r_cmd = ['--enablerepo=%s' % enablerepo]
|
||||||
for repoid in dis_repos:
|
|
||||||
r_cmd = ['--disablerepo=%s' % repoid]
|
|
||||||
yum_basecmd.extend(r_cmd)
|
yum_basecmd.extend(r_cmd)
|
||||||
|
|
||||||
for repoid in en_repos:
|
|
||||||
r_cmd = ['--enablerepo=%s' % repoid]
|
|
||||||
yum_basecmd.extend(r_cmd)
|
|
||||||
|
|
||||||
if state in ['installed', 'present', 'latest']:
|
if state in ['installed', 'present', 'latest']:
|
||||||
|
|
||||||
|
@ -763,13 +755,12 @@ def ensure(module, state, pkgspec, conf_file, enablerepo, disablerepo,
|
||||||
|
|
||||||
my = yum_base(conf_file)
|
my = yum_base(conf_file)
|
||||||
try:
|
try:
|
||||||
for r in dis_repos:
|
if disablerepo:
|
||||||
my.repos.disableRepo(r)
|
my.repos.disableRepo(disablerepo)
|
||||||
|
|
||||||
current_repos = my.repos.repos.keys()
|
current_repos = my.repos.repos.keys()
|
||||||
for r in en_repos:
|
if enablerepo:
|
||||||
try:
|
try:
|
||||||
my.repos.enableRepo(r)
|
my.repos.enableRepo(enablerepo)
|
||||||
new_repos = my.repos.repos.keys()
|
new_repos = my.repos.repos.keys()
|
||||||
for i in new_repos:
|
for i in new_repos:
|
||||||
if not i in current_repos:
|
if not i in current_repos:
|
||||||
|
@ -780,7 +771,6 @@ def ensure(module, state, pkgspec, conf_file, enablerepo, disablerepo,
|
||||||
module.fail_json(msg="Error setting/accessing repo %s: %s" % (r, e))
|
module.fail_json(msg="Error setting/accessing repo %s: %s" % (r, e))
|
||||||
except yum.Errors.YumBaseError, e:
|
except yum.Errors.YumBaseError, e:
|
||||||
module.fail_json(msg="Error accessing repos: %s" % e)
|
module.fail_json(msg="Error accessing repos: %s" % e)
|
||||||
|
|
||||||
if state in ['installed', 'present']:
|
if state in ['installed', 'present']:
|
||||||
if disable_gpg_check:
|
if disable_gpg_check:
|
||||||
yum_basecmd.append('--nogpgcheck')
|
yum_basecmd.append('--nogpgcheck')
|
||||||
|
|
Loading…
Reference in a new issue