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
bce6642a
Commit
bce6642a
authored
Jul 28, 2014
by
Victor Lin
Committed by
James Cammarata
Aug 27, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement default omit correctly
parent
0b4d7f15
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
lib/ansible/runner/__init__.py
+7
-4
lib/ansible/runner/filter_plugins/core.py
+3
-4
No files found.
lib/ansible/runner/__init__.py
View file @
bce6642a
...
...
@@ -870,10 +870,6 @@ class Runner(object):
if
type
(
module_args
)
==
dict
:
new_args
=
[]
for
(
k
,
v
)
in
module_args
.
iteritems
():
# see if the value is OMIT_PLACE_HOLDER, if it is, skip it
arg_value
=
template
.
template
(
self
.
basedir
,
v
,
inject
,
fail_on_undefined
=
self
.
error_on_undefined_vars
)
if
arg_value
.
strip
()
==
OMIT_PLACE_HOLDER
:
continue
new_args
.
append
(
"
%
s='
%
s'"
%
(
k
,
v
))
module_args
=
' '
.
join
(
new_args
)
...
...
@@ -897,6 +893,13 @@ class Runner(object):
except
jinja2
.
exceptions
.
UndefinedError
,
e
:
raise
errors
.
AnsibleUndefinedVariable
(
"One or more undefined variables:
%
s"
%
str
(
e
))
# filter omitted arguments out
new_complex_args
=
{}
for
key
,
value
in
complex_args
.
iteritems
():
if
value
==
OMIT_PLACE_HOLDER
:
continue
new_complex_args
[
key
]
=
value
complex_args
=
new_complex_args
result
=
handler
.
run
(
conn
,
tmp
,
module_name
,
module_args
,
inject
,
complex_args
)
# Code for do until feature
...
...
lib/ansible/runner/filter_plugins/core.py
View file @
bce6642a
...
...
@@ -32,6 +32,7 @@ from ansible.utils import md5s, OMIT_PLACE_HOLDER
from
distutils.version
import
LooseVersion
,
StrictVersion
from
random
import
SystemRandom
from
jinja2.filters
import
environmentfilter
from
jinja2.runtime
import
Undefined
def
to_nice_yaml
(
*
a
,
**
kw
):
...
...
@@ -237,12 +238,10 @@ def rand(environment, end, start=None, step=None):
else
:
raise
errors
.
AnsibleFilterError
(
'random can only be used on sequences and integers'
)
def
default_omit
(
a
):
try
:
a
except
NameError
:
if
isinstance
(
a
,
Undefined
):
return
OMIT_PLACE_HOLDER
else
:
return
a
...
...
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