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
ae8d6ac3
Commit
ae8d6ac3
authored
Feb 28, 2013
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure complex_args is considered in all action_plugins
parent
29725972
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
39 additions
and
14 deletions
+39
-14
lib/ansible/module_common.py
+2
-1
lib/ansible/runner/action_plugins/add_host.py
+4
-1
lib/ansible/runner/action_plugins/async.py
+1
-1
lib/ansible/runner/action_plugins/copy.py
+6
-3
lib/ansible/runner/action_plugins/debug.py
+4
-1
lib/ansible/runner/action_plugins/fail.py
+4
-1
lib/ansible/runner/action_plugins/fetch.py
+4
-1
lib/ansible/runner/action_plugins/group_by.py
+4
-1
lib/ansible/runner/action_plugins/pause.py
+4
-1
lib/ansible/runner/action_plugins/template.py
+6
-3
No files found.
lib/ansible/module_common.py
View file @
ae8d6ac3
...
...
@@ -379,7 +379,8 @@ class AnsibleModule(object):
return changed
try:
# FIXME: support English modes
mode = int(mode, 8)
if not isinstance(mode, int):
mode = int(mode, 8)
except Exception, e:
self.fail_json(path=path, msg='mode needs to be something octalish', details=str(e))
...
...
lib/ansible/runner/action_plugins/add_host.py
View file @
ae8d6ac3
...
...
@@ -39,7 +39,10 @@ class ActionModule(object):
if
self
.
runner
.
check
:
return
ReturnData
(
conn
=
conn
,
comm_ok
=
True
,
result
=
dict
(
skipped
=
True
,
msg
=
'check mode not supported for this module'
))
args
=
parse_kv
(
module_args
)
args
=
{}
if
complex_args
:
args
.
update
(
complex_args
)
args
.
update
(
parse_kv
(
module_args
))
if
not
'hostname'
in
args
and
not
'name'
in
args
:
raise
ae
(
"'name' is a required argument."
)
...
...
lib/ansible/runner/action_plugins/async.py
View file @
ae8d6ac3
...
...
@@ -33,7 +33,7 @@ class ActionModule(object):
module_name
=
'command'
module_args
+=
" #USE_SHELL"
(
module_path
,
is_new_style
,
shebang
)
=
self
.
runner
.
_copy_module
(
conn
,
tmp
,
module_name
,
module_args
,
inject
)
(
module_path
,
is_new_style
,
shebang
)
=
self
.
runner
.
_copy_module
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
=
complex_args
)
self
.
runner
.
_low_level_exec_command
(
conn
,
"chmod a+rx
%
s"
%
module_path
,
tmp
)
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'async_wrapper'
,
module_args
,
...
...
lib/ansible/runner/action_plugins/copy.py
View file @
ae8d6ac3
...
...
@@ -32,7 +32,10 @@ class ActionModule(object):
''' handler for file transfer operations '''
# load up options
options
=
utils
.
parse_kv
(
module_args
)
options
=
{}
if
complex_args
:
options
.
update
(
complex_args
)
options
.
update
(
utils
.
parse_kv
(
module_args
))
source
=
options
.
get
(
'src'
,
None
)
dest
=
options
.
get
(
'dest'
,
None
)
...
...
@@ -93,7 +96,7 @@ class ActionModule(object):
# run the copy module
module_args
=
"
%
s src=
%
s"
%
(
module_args
,
tmp_src
)
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'copy'
,
module_args
,
inject
=
inject
)
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'copy'
,
module_args
,
inject
=
inject
,
complex_args
=
complex_args
)
else
:
# no need to transfer the file, already correct md5, but still need to call
...
...
@@ -103,7 +106,7 @@ class ActionModule(object):
module_args
=
"
%
s src=
%
s"
%
(
module_args
,
tmp_src
)
if
self
.
runner
.
check
:
module_args
=
"
%
s CHECKMODE=True"
%
module_args
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'file'
,
module_args
,
inject
=
inject
)
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'file'
,
module_args
,
inject
=
inject
,
complex_args
=
complex_args
)
def
_get_diff_data
(
self
,
conn
,
tmp
,
inject
,
destination
,
source
):
peek_result
=
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'file'
,
"path=
%
s diff_peek=1"
%
destination
,
inject
=
inject
,
persist_files
=
True
)
...
...
lib/ansible/runner/action_plugins/debug.py
View file @
ae8d6ac3
...
...
@@ -29,7 +29,10 @@ class ActionModule(object):
self
.
runner
=
runner
def
run
(
self
,
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
=
None
,
**
kwargs
):
args
=
utils
.
parse_kv
(
module_args
)
args
=
{}
if
complex_args
:
args
.
update
(
complex_args
)
args
.
update
(
utils
.
parse_kv
(
module_args
))
if
not
'msg'
in
args
:
args
[
'msg'
]
=
'Hello world!'
...
...
lib/ansible/runner/action_plugins/fail.py
View file @
ae8d6ac3
...
...
@@ -33,7 +33,10 @@ class ActionModule(object):
# note: the fail module does not need to pay attention to check mode
# it always runs.
args
=
utils
.
parse_kv
(
module_args
)
args
=
{}
if
complex_args
:
args
.
update
(
complex_args
)
args
.
update
(
utils
.
parse_kv
(
module_args
))
if
not
'msg'
in
args
:
args
[
'msg'
]
=
'Failed as requested from task'
...
...
lib/ansible/runner/action_plugins/fetch.py
View file @
ae8d6ac3
...
...
@@ -40,7 +40,10 @@ class ActionModule(object):
return
ReturnData
(
conn
=
conn
,
comm_ok
=
True
,
result
=
dict
(
skipped
=
True
,
msg
=
'check mode not (yet) supported for this module'
))
# load up options
options
=
utils
.
parse_kv
(
module_args
)
options
=
{}
if
complex_args
:
options
.
update
(
complex_args
)
options
.
update
(
utils
.
parse_kv
(
module_args
))
source
=
options
.
get
(
'src'
,
None
)
dest
=
options
.
get
(
'dest'
,
None
)
if
source
is
None
or
dest
is
None
:
...
...
lib/ansible/runner/action_plugins/group_by.py
View file @
ae8d6ac3
...
...
@@ -37,7 +37,10 @@ class ActionModule(object):
# the group_by module does not need to pay attention to check mode.
# it always runs.
args
=
parse_kv
(
self
.
runner
.
module_args
)
args
=
{}
if
complex_args
:
args
.
update
(
complex_args
)
args
.
update
(
utils
.
parse_kv
(
module_args
))
if
not
'key'
in
args
:
raise
ae
(
"'key' is a required argument."
)
...
...
lib/ansible/runner/action_plugins/pause.py
View file @
ae8d6ac3
...
...
@@ -53,7 +53,10 @@ class ActionModule(object):
# flag, it always runs
hosts
=
', '
.
join
(
self
.
runner
.
host_set
)
args
=
parse_kv
(
template
(
self
.
runner
.
basedir
,
module_args
,
inject
))
args
=
{}
if
complex_args
:
args
.
update
(
complex_args
)
args
.
update
(
parse_kv
(
template
(
self
.
runner
.
basedir
,
module_args
,
inject
)))
# Are 'minutes' or 'seconds' keys that exist in 'args'?
if
'minutes'
in
args
or
'seconds'
in
args
:
...
...
lib/ansible/runner/action_plugins/template.py
View file @
ae8d6ac3
...
...
@@ -37,7 +37,10 @@ class ActionModule(object):
raise
errors
.
AnsibleError
(
"in current versions of ansible, templates are only usable in playbooks"
)
# load up options
options
=
utils
.
parse_kv
(
module_args
)
options
=
{}
if
complex_args
:
options
.
update
(
complex_args
)
options
.
update
(
utils
.
parse_kv
(
module_args
))
source
=
options
.
get
(
'src'
,
None
)
dest
=
options
.
get
(
'dest'
,
None
)
...
...
@@ -106,9 +109,9 @@ class ActionModule(object):
if
self
.
runner
.
check
:
return
ReturnData
(
conn
=
conn
,
comm_ok
=
True
,
result
=
dict
(
changed
=
True
),
diff
=
dict
(
before_header
=
dest
,
after_header
=
source
,
before
=
dest_contents
,
after
=
resultant
))
else
:
res
=
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'copy'
,
module_args
,
inject
=
inject
)
res
=
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'copy'
,
module_args
,
inject
=
inject
,
complex_args
=
complex_args
)
res
.
diff
=
dict
(
before
=
dest_contents
,
after
=
resultant
)
return
res
else
:
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'file'
,
module_args
,
inject
=
inject
)
return
self
.
runner
.
_execute_module
(
conn
,
tmp
,
'file'
,
module_args
,
inject
=
inject
,
complex_args
=
complex_args
)
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