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
a347bfa2
Commit
a347bfa2
authored
Aug 17, 2013
by
Mark Harrison
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pacman_local' into pacman_local_plus_check
Conflicts: library/packaging/pacman
parents
0419fb74
f52a1c8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
library/packaging/pacman
+21
-5
No files found.
library/packaging/pacman
View file @
a347bfa2
...
...
@@ -79,6 +79,7 @@ EXAMPLES = '''
import
json
import
shlex
import
os
import
re
import
sys
PACMAN_PATH
=
"/usr/bin/pacman"
...
...
@@ -130,15 +131,20 @@ def remove_packages(module, packages):
module
.
exit_json
(
changed
=
False
,
msg
=
"package(s) already absent"
)
def
install_packages
(
module
,
packages
):
def
install_packages
(
module
,
packages
,
package_files
):
install_c
=
0
for
package
in
packages
:
for
i
,
package
in
enumerate
(
packages
)
:
if
query_package
(
module
,
package
):
continue
rc
=
os
.
system
(
"pacman -S
%
s --noconfirm > /dev/null"
%
(
package
))
if
package_files
[
i
]:
params
=
'-U
%
s'
%
package_files
[
i
]
else
:
params
=
'-S
%
s'
%
package
rc
=
os
.
system
(
"pacman
%
s --noconfirm > /dev/null"
%
(
params
))
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"failed to install
%
s"
%
(
package
))
...
...
@@ -187,11 +193,21 @@ def main():
pkgs
=
p
[
"name"
]
.
split
(
","
)
pkg_files
=
[]
for
i
,
pkg
in
enumerate
(
pkgs
):
if
pkg
.
endswith
(
'.pkg.tar.xz'
):
# The package given is a filename, extract the raw pkg name from
# it and store the filename
pkg_files
.
append
(
pkg
)
pkgs
[
i
]
=
re
.
sub
(
'-[0-9].*$'
,
''
,
pkgs
[
i
]
.
split
(
'/'
)[
-
1
])
else
:
pkg_files
.
append
(
None
)
if
module
.
check_mode
:
check_packages
(
module
,
pkgs
,
p
[
'state'
])
el
if
p
[
"state"
]
==
"installed"
:
install_packages
(
module
,
pkgs
)
if
p
[
"state"
]
==
"installed"
:
install_packages
(
module
,
pkgs
,
pkg_files
)
elif
p
[
"state"
]
==
"absent"
:
remove_packages
(
module
,
pkgs
)
...
...
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