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
c4593479
Commit
c4593479
authored
Nov 11, 2013
by
jctanner
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4245 from abelbabel/patch-1
add check mode support to pkgng module
parents
7502e152
effcb963
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
library/packaging/pkgng
+13
-10
No files found.
library/packaging/pkgng
View file @
c4593479
...
@@ -89,9 +89,10 @@ def remove_packages(module, pkgin_path, packages):
...
@@ -89,9 +89,10 @@ def remove_packages(module, pkgin_path, packages):
if
not
query_package
(
module
,
pkgin_path
,
package
):
if
not
query_package
(
module
,
pkgin_path
,
package
):
continue
continue
rc
,
out
,
err
=
module
.
run_command
(
"
%
s delete -y
%
s"
%
(
pkgin_path
,
package
))
if
not
module
.
check_mode
:
rc
,
out
,
err
=
module
.
run_command
(
"
%
s delete -y
%
s"
%
(
pkgin_path
,
package
))
if
query_package
(
module
,
pkgin_path
,
package
):
if
not
module
.
check_mode
and
query_package
(
module
,
pkgin_path
,
package
):
module
.
fail_json
(
msg
=
"failed to remove
%
s:
%
s"
%
(
package
,
out
))
module
.
fail_json
(
msg
=
"failed to remove
%
s:
%
s"
%
(
package
,
out
))
remove_c
+=
1
remove_c
+=
1
...
@@ -110,7 +111,7 @@ def install_packages(module, pkgin_path, packages, cached, pkgsite):
...
@@ -110,7 +111,7 @@ def install_packages(module, pkgin_path, packages, cached, pkgsite):
if
pkgsite
!=
""
:
if
pkgsite
!=
""
:
pkgsite
=
"PACKAGESITE=
%
s"
%
(
pkgsite
)
pkgsite
=
"PACKAGESITE=
%
s"
%
(
pkgsite
)
if
cached
==
"no"
:
if
not
module
.
check_mode
and
cached
==
"no"
:
rc
,
out
,
err
=
module
.
run_command
(
"
%
s
%
s update"
%
(
pkgsite
,
pkgin_path
))
rc
,
out
,
err
=
module
.
run_command
(
"
%
s
%
s update"
%
(
pkgsite
,
pkgin_path
))
if
rc
!=
0
:
if
rc
!=
0
:
module
.
fail_json
(
msg
=
"Could not update catalogue"
)
module
.
fail_json
(
msg
=
"Could not update catalogue"
)
...
@@ -119,9 +120,10 @@ def install_packages(module, pkgin_path, packages, cached, pkgsite):
...
@@ -119,9 +120,10 @@ def install_packages(module, pkgin_path, packages, cached, pkgsite):
if
query_package
(
module
,
pkgin_path
,
package
):
if
query_package
(
module
,
pkgin_path
,
package
):
continue
continue
rc
,
out
,
err
=
module
.
run_command
(
"
%
s
%
s install -U -y
%
s"
%
(
pkgsite
,
pkgin_path
,
package
))
if
not
module
.
check_mode
:
rc
,
out
,
err
=
module
.
run_command
(
"
%
s
%
s install -U -y
%
s"
%
(
pkgsite
,
pkgin_path
,
package
))
if
not
query_package
(
module
,
pkgin_path
,
package
):
if
not
module
.
check_mode
and
query_package
(
module
,
pkgin_path
,
package
):
module
.
fail_json
(
msg
=
"failed to install
%
s:
%
s"
%
(
package
,
out
))
module
.
fail_json
(
msg
=
"failed to install
%
s:
%
s"
%
(
package
,
out
))
install_c
+=
1
install_c
+=
1
...
@@ -134,11 +136,12 @@ def install_packages(module, pkgin_path, packages, cached, pkgsite):
...
@@ -134,11 +136,12 @@ def install_packages(module, pkgin_path, packages, cached, pkgsite):
def
main
():
def
main
():
module
=
AnsibleModule
(
module
=
AnsibleModule
(
argument_spec
=
dict
(
argument_spec
=
dict
(
state
=
dict
(
default
=
"present"
,
choices
=
[
"present"
,
"absent"
]),
state
=
dict
(
default
=
"present"
,
choices
=
[
"present"
,
"absent"
]),
name
=
dict
(
aliases
=
[
"pkg"
],
required
=
True
),
name
=
dict
(
aliases
=
[
"pkg"
],
required
=
True
),
cached
=
dict
(
default
=
"no"
,
required
=
False
,
choices
=
[
"yes"
,
"no"
]),
cached
=
dict
(
default
=
"no"
,
required
=
False
,
choices
=
[
"yes"
,
"no"
]),
pkgsite
=
dict
(
default
=
""
,
required
=
False
)))
pkgsite
=
dict
(
default
=
""
,
required
=
False
)),
supports_check_mode
=
True
)
pkgin_path
=
module
.
get_bin_path
(
'pkg'
,
True
)
pkgin_path
=
module
.
get_bin_path
(
'pkg'
,
True
)
...
...
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