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
76f3351b
Commit
76f3351b
authored
Mar 07, 2013
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move complex_args templating to be with module_args
Keeps every action plugin from having to do the same thing.
parent
ffbd4b5a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
10 deletions
+5
-10
lib/ansible/runner/__init__.py
+5
-5
lib/ansible/runner/action_plugins/copy.py
+0
-2
lib/ansible/runner/action_plugins/normal.py
+0
-1
lib/ansible/runner/action_plugins/template.py
+0
-2
No files found.
lib/ansible/runner/__init__.py
View file @
76f3351b
...
...
@@ -351,7 +351,7 @@ class Runner(object):
# logic to decide how to run things depends on whether with_items is used
if
items
is
None
:
return
self
.
_executor_internal_inner
(
host
,
self
.
module_name
,
self
.
module_args
,
inject
,
port
)
return
self
.
_executor_internal_inner
(
host
,
self
.
module_name
,
self
.
module_args
,
inject
,
port
,
complex_args
=
self
.
complex_args
)
elif
len
(
items
)
>
0
:
# executing using with_items, so make multiple calls
# TODO: refactor
...
...
@@ -362,7 +362,7 @@ class Runner(object):
results
=
[]
for
x
in
items
:
inject
[
'item'
]
=
x
result
=
self
.
_executor_internal_inner
(
host
,
self
.
module_name
,
self
.
module_args
,
inject
,
port
)
result
=
self
.
_executor_internal_inner
(
host
,
self
.
module_name
,
self
.
module_args
,
inject
,
port
,
complex_args
=
self
.
complex_args
)
results
.
append
(
result
.
result
)
if
result
.
comm_ok
==
False
:
all_comm_ok
=
False
...
...
@@ -387,7 +387,7 @@ class Runner(object):
# *****************************************************
def
_executor_internal_inner
(
self
,
host
,
module_name
,
module_args
,
inject
,
port
,
is_chained
=
False
):
def
_executor_internal_inner
(
self
,
host
,
module_name
,
module_args
,
inject
,
port
,
is_chained
=
False
,
complex_args
=
None
):
''' decides how to invoke a module '''
...
...
@@ -401,7 +401,7 @@ class Runner(object):
module_name
=
utils
.
template
(
self
.
basedir
,
module_name
,
inject
)
module_args
=
utils
.
template
(
self
.
basedir
,
module_args
,
inject
)
complex_args
=
utils
.
template
(
self
.
basedir
,
complex_args
,
inject
)
if
module_name
in
utils
.
plugins
.
action_loader
:
if
self
.
background
!=
0
:
...
...
@@ -479,7 +479,7 @@ class Runner(object):
if
getattr
(
handler
,
'NEEDS_TMPPATH'
,
True
):
tmp
=
self
.
_make_tmp_path
(
conn
)
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
self
.
complex_args
)
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
conn
.
close
()
...
...
lib/ansible/runner/action_plugins/copy.py
View file @
76f3351b
...
...
@@ -36,10 +36,8 @@ class ActionModule(object):
if
complex_args
:
options
.
update
(
complex_args
)
options
.
update
(
utils
.
parse_kv
(
module_args
))
options
=
utils
.
template
(
self
.
runner
.
basedir
,
options
,
inject
)
source
=
options
.
get
(
'src'
,
None
)
dest
=
options
.
get
(
'dest'
,
None
)
module_args
=
self
.
runner
.
_complex_args_hack
(
options
,
''
)
if
(
source
is
None
and
not
'first_available_file'
in
inject
)
or
dest
is
None
:
result
=
dict
(
failed
=
True
,
msg
=
"src and dest are required"
)
...
...
lib/ansible/runner/action_plugins/normal.py
View file @
76f3351b
...
...
@@ -36,7 +36,6 @@ class ActionModule(object):
def
run
(
self
,
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
=
None
,
**
kwargs
):
''' transfer & execute a module that is not 'copy' or 'template' '''
complex_args
=
utils
.
template
(
self
.
runner
.
basedir
,
complex_args
,
inject
)
module_args
=
self
.
runner
.
_complex_args_hack
(
complex_args
,
module_args
)
if
self
.
runner
.
check
:
...
...
lib/ansible/runner/action_plugins/template.py
View file @
76f3351b
...
...
@@ -41,8 +41,6 @@ class ActionModule(object):
if
complex_args
:
options
.
update
(
complex_args
)
options
.
update
(
utils
.
parse_kv
(
module_args
))
options
=
utils
.
template
(
self
.
runner
.
basedir
,
options
,
inject
)
module_args
=
self
.
runner
.
_complex_args_hack
(
options
,
''
)
source
=
options
.
get
(
'src'
,
None
)
dest
=
options
.
get
(
'dest'
,
None
)
...
...
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