Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
d8337dab
Commit
d8337dab
authored
Oct 24, 2012
by
Seth Vidal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tested and verified yum enable/disablerepo option for yum module
parent
d89d0755
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
14 deletions
+15
-14
library/yum
+15
-14
No files found.
library/yum
View file @
d8337dab
...
@@ -139,7 +139,7 @@ def is_installed(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_
...
@@ -139,7 +139,7 @@ def is_installed(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_
out
+=
out2
out
+=
out2
return
[
p
for
p
in
out
.
split
(
'
\n
'
)
if
p
.
strip
()
]
return
[
p
for
p
in
out
.
split
(
'
\n
'
)
if
p
.
strip
()
]
else
:
else
:
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s
'
%
err
+
err2
)
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s
:
%
s'
%
(
cmd
,
err
+
err2
)
)
return
[]
return
[]
...
@@ -171,7 +171,8 @@ def is_available(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_
...
@@ -171,7 +171,8 @@ def is_available(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_
if
rc
==
0
:
if
rc
==
0
:
return
[
p
for
p
in
out
.
split
(
'
\n
'
)
if
p
.
strip
()
]
return
[
p
for
p
in
out
.
split
(
'
\n
'
)
if
p
.
strip
()
]
else
:
else
:
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s'
%
err
)
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s:
%
s'
%
(
cmd
,
err
+
err2
))
return
[]
return
[]
...
@@ -212,7 +213,7 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_rep
...
@@ -212,7 +213,7 @@ def is_update(module, repoq, pkgspec, conf_file, qf=def_qf, en_repos=[], dis_rep
if
rc
==
0
:
if
rc
==
0
:
return
set
([
p
for
p
in
out
.
split
(
'
\n
'
)
if
p
.
strip
()
])
return
set
([
p
for
p
in
out
.
split
(
'
\n
'
)
if
p
.
strip
()
])
else
:
else
:
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s
'
%
err
)
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s
:
%
s'
%
(
cmd
,
err
+
err2
)
)
return
[]
return
[]
...
@@ -254,8 +255,8 @@ def what_provides(module, repoq, req_spec, conf_file, qf=def_qf, en_repos=[], d
...
@@ -254,8 +255,8 @@ def what_provides(module, repoq, req_spec, conf_file, qf=def_qf, en_repos=[], d
pkgs
=
is_installed
(
module
,
repoq
,
req_spec
,
conf_file
,
qf
=
qf
)
pkgs
=
is_installed
(
module
,
repoq
,
req_spec
,
conf_file
,
qf
=
qf
)
return
pkgs
return
pkgs
else
:
else
:
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s
'
%
err
+
err2
)
module
.
fail_json
(
msg
=
'Error from repoquery:
%
s
:
%
s'
%
(
cmd
,
err
+
err2
)
)
return
[]
return
[]
def
local_nvra
(
path
):
def
local_nvra
(
path
):
...
@@ -365,7 +366,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
...
@@ -365,7 +366,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
nvra
=
local_nvra
(
spec
)
nvra
=
local_nvra
(
spec
)
# look for them in the rpmdb
# look for them in the rpmdb
if
is_installed
(
module
,
repoq
,
nvra
,
conf_file
,
en_repos
,
dis_repos
):
if
is_installed
(
module
,
repoq
,
nvra
,
conf_file
,
en_repos
=
en_repos
,
dis_repos
=
dis_repos
):
# if they are there, skip it
# if they are there, skip it
continue
continue
pkg
=
spec
pkg
=
spec
...
@@ -377,7 +378,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
...
@@ -377,7 +378,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
# range requires or file-requires or pkgname :(
# range requires or file-requires or pkgname :(
else
:
else
:
# look up what pkgs provide this
# look up what pkgs provide this
pkglist
=
what_provides
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
,
dis_repos
)
pkglist
=
what_provides
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
=
en_repos
,
dis_repos
=
dis_repos
)
if
not
pkglist
:
if
not
pkglist
:
res
[
'msg'
]
+=
"No Package matching '
%
s' found available, installed or updated"
%
spec
res
[
'msg'
]
+=
"No Package matching '
%
s' found available, installed or updated"
%
spec
module
.
fail_json
(
**
res
)
module
.
fail_json
(
**
res
)
...
@@ -387,7 +388,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
...
@@ -387,7 +388,7 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
found
=
False
found
=
False
for
this
in
pkglist
:
for
this
in
pkglist
:
if
is_installed
(
module
,
repoq
,
this
,
conf_file
,
en_repos
,
dis_repos
):
if
is_installed
(
module
,
repoq
,
this
,
conf_file
,
en_repos
=
en_repos
,
dis_repos
=
dis_repos
):
found
=
True
found
=
True
res
[
'results'
]
.
append
(
'
%
s providing
%
s is already installed'
%
(
this
,
spec
))
res
[
'results'
]
.
append
(
'
%
s providing
%
s is already installed'
%
(
this
,
spec
))
break
break
...
@@ -434,14 +435,14 @@ def remove(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
...
@@ -434,14 +435,14 @@ def remove(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
pkg
=
spec
pkg
=
spec
# req or pkgname remove
# req or pkgname remove
else
:
else
:
pkglist
=
is_installed
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
,
dis_repos
)
pkglist
=
is_installed
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
=
en_repos
,
dis_repos
=
dis_repos
)
if
not
pkglist
:
if
not
pkglist
:
res
[
'msg'
]
+=
"No Package matching '
%
s' found installed"
%
spec
res
[
'msg'
]
+=
"No Package matching '
%
s' found installed"
%
spec
module
.
exit_json
(
**
res
)
module
.
exit_json
(
**
res
)
found
=
False
found
=
False
for
this
in
pkglist
:
for
this
in
pkglist
:
if
is_installed
(
module
,
repoq
,
this
,
conf_file
,
en_repos
,
dis_repos
):
if
is_installed
(
module
,
repoq
,
this
,
conf_file
,
en_repos
=
en_repos
,
dis_repos
=
dis_repos
):
found
=
True
found
=
True
if
not
found
:
if
not
found
:
...
@@ -485,12 +486,12 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
...
@@ -485,12 +486,12 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
pkg
=
spec
pkg
=
spec
# dep/pkgname - find it
# dep/pkgname - find it
else
:
else
:
if
is_installed
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
,
dis_repos
):
if
is_installed
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
=
en_repos
,
dis_repos
=
dis_repos
):
basecmd
=
'update'
basecmd
=
'update'
else
:
else
:
basecmd
=
'install'
basecmd
=
'install'
pkglist
=
what_provides
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
,
dis_repos
)
pkglist
=
what_provides
(
module
,
repoq
,
spec
,
conf_file
,
en_repos
=
en_repos
,
dis_repos
=
dis_repos
)
if
not
pkglist
:
if
not
pkglist
:
res
[
'msg'
]
+=
"No Package matching '
%
s' found available, installed or updated"
%
spec
res
[
'msg'
]
+=
"No Package matching '
%
s' found available, installed or updated"
%
spec
res
[
'failed'
]
=
True
res
[
'failed'
]
=
True
...
@@ -498,11 +499,11 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
...
@@ -498,11 +499,11 @@ def latest(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):
nothing_to_do
=
True
nothing_to_do
=
True
for
this
in
pkglist
:
for
this
in
pkglist
:
if
basecmd
==
'install'
and
is_available
(
module
,
repoq
,
this
,
conf_file
,
en_repos
,
dis_repos
):
if
basecmd
==
'install'
and
is_available
(
module
,
repoq
,
this
,
conf_file
,
en_repos
=
en_repos
,
dis_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
,
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment