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
a6ad3746
Commit
a6ad3746
authored
Aug 27, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use split_args directly to check for omitted params
parent
04da466c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
lib/ansible/runner/__init__.py
+19
-11
No files found.
lib/ansible/runner/__init__.py
View file @
a6ad3746
...
@@ -46,7 +46,7 @@ import connection
...
@@ -46,7 +46,7 @@ import connection
from
return_data
import
ReturnData
from
return_data
import
ReturnData
from
ansible.callbacks
import
DefaultRunnerCallbacks
,
vv
from
ansible.callbacks
import
DefaultRunnerCallbacks
,
vv
from
ansible.module_common
import
ModuleReplacer
from
ansible.module_common
import
ModuleReplacer
from
ansible.module_utils.splitter
import
split_args
from
ansible.module_utils.splitter
import
split_args
,
unquote
from
ansible.cache
import
FactCache
from
ansible.cache
import
FactCache
from
ansible.utils
import
update_hash
from
ansible.utils
import
update_hash
...
@@ -896,16 +896,24 @@ class Runner(object):
...
@@ -896,16 +896,24 @@ class Runner(object):
except
jinja2
.
exceptions
.
UndefinedError
,
e
:
except
jinja2
.
exceptions
.
UndefinedError
,
e
:
raise
errors
.
AnsibleUndefinedVariable
(
"One or more undefined variables:
%
s"
%
str
(
e
))
raise
errors
.
AnsibleUndefinedVariable
(
"One or more undefined variables:
%
s"
%
str
(
e
))
def
not_omitted
(
item
):
# filter omitted arguments out from complex_args
return
item
[
1
]
!=
self
.
omit_token
if
complex_args
:
complex_args
=
dict
(
filter
(
lambda
x
:
x
[
1
]
!=
self
.
omit_token
,
complex_args
.
iteritems
()))
if
module_name
not
in
[
'shell'
,
'command'
,
'include_vars'
]:
# filter omitted arguments out from complex_args
# Filter omitted arguments out from module_args.
complex_args
=
dict
(
filter
(
not_omitted
,
complex_args
.
iteritems
()))
# We do this with split_args instead of parse_kv to ensure
# filter omitted arguments out from module_args
# that things are not unquoted/requoted incorrectly
module_kv
=
utils
.
parse_kv
(
module_args
)
args
=
split_args
(
module_args
)
module_kv
=
dict
(
filter
(
not_omitted
,
module_kv
.
iteritems
()))
final_args
=
[]
module_args
=
utils
.
serialize_args
(
module_kv
)
for
arg
in
args
:
if
'='
in
arg
:
k
,
v
=
arg
.
split
(
'='
,
1
)
if
unquote
(
v
)
!=
self
.
omit_token
:
final_args
.
append
(
arg
)
else
:
# not a k=v param, append it
final_args
.
append
(
arg
)
module_args
=
' '
.
join
(
final_args
)
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
# Code for do until feature
# Code for do until feature
...
...
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