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
e99db078
Commit
e99db078
authored
Aug 05, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional fixes for the new omit parameter variable
parent
6260635c
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
13 deletions
+16
-13
lib/ansible/runner/__init__.py
+13
-2
lib/ansible/utils/__init__.py
+0
-8
test/integration/roles/test_good_parsing/tasks/main.yml
+3
-3
No files found.
lib/ansible/runner/__init__.py
View file @
e99db078
...
...
@@ -53,6 +53,11 @@ from ansible.utils import OMIT_PLACE_HOLDER
module_replacer
=
ModuleReplacer
(
strip_comments
=
False
)
try
:
from
hashlib
import
md5
as
_md5
except
ImportError
:
from
md5
import
md5
as
_md5
HAS_ATFORK
=
True
try
:
from
Crypto.Random
import
atfork
...
...
@@ -203,6 +208,7 @@ class Runner(object):
self
.
su_user_var
=
su_user
self
.
su_user
=
None
self
.
su_pass
=
su_pass
self
.
omit_token
=
'__omit_place_holder__
%
s'
%
_md5
(
os
.
urandom
(
64
))
.
hexdigest
()
self
.
vault_pass
=
vault_pass
self
.
no_log
=
no_log
self
.
run_once
=
run_once
...
...
@@ -623,8 +629,13 @@ class Runner(object):
inject
[
'vars'
]
=
self
.
module_vars
inject
[
'defaults'
]
=
self
.
default_vars
inject
[
'environment'
]
=
self
.
environment
<<<<<<<
HEAD
inject
[
'playbook_dir'
]
=
os
.
path
.
abspath
(
self
.
basedir
)
inject
[
'omit'
]
=
OMIT_PLACE_HOLDER
=======
inject
[
'playbook_dir'
]
=
self
.
basedir
inject
[
'omit'
]
=
self
.
omit_token
>>>>>>>
Additional
fixes
for
the
new
omit
parameter
variable
# template this one is available, callbacks use this
delegate_to
=
self
.
module_vars
.
get
(
'delegate_to'
)
...
...
@@ -892,9 +903,9 @@ class Runner(object):
raise
errors
.
AnsibleUndefinedVariable
(
"One or more undefined variables:
%
s"
%
str
(
e
))
def
not_omitted
(
item
):
return
item
[
1
]
!=
OMIT_PLACE_HOLDER
return
item
[
1
]
!=
self
.
omit_token
if
module_name
not
in
[
'shell'
,
'command'
]:
if
module_name
not
in
[
'shell'
,
'command'
,
'include_vars'
]:
# filter omitted arguments out from complex_args
complex_args
=
dict
(
filter
(
not_omitted
,
complex_args
.
iteritems
()))
# filter omitted arguments out from module_args
...
...
lib/ansible/utils/__init__.py
View file @
e99db078
...
...
@@ -112,10 +112,6 @@ except ImportError:
pass
OMIT_PLACE_HOLDER
=
(
'__omit_place_holder__
%
s'
%
_md5
(
os
.
urandom
(
64
))
.
hexdigest
()
)
###############################################################
# Abstractions around keyczar
###############################################################
...
...
@@ -787,10 +783,6 @@ def _validate_both_dicts(a, b):
"failed to combine variables, expected dicts but got a '
%
s' and a '
%
s'"
%
(
type
(
a
)
.
__name__
,
type
(
b
)
.
__name__
)
)
def
serialize_args
(
args
):
''' convert a dict to a string of key/value items '''
return
' '
.
join
(
"
%
s='
%
s'"
%
item
for
item
in
args
.
iteritems
())
def
merge_hash
(
a
,
b
):
''' recursively merges hash b into a
keys from b take precedence over keys from a '''
...
...
test/integration/roles/test_good_parsing/tasks/main.yml
View file @
e99db078
...
...
@@ -183,7 +183,7 @@
that
:
-
foo == 'bar'
-
spam is undefined
-
should_not_omit
== "prefix{{ omit }}"
-
should_not_omit
is defined
-
name
:
test omit in module args
set_fact
:
>
...
...
@@ -199,6 +199,6 @@
-
yo == 'whatsup'
-
eggs is undefined
-
default_omitted is undefined
-
should_not_omit_1
== "prefix{{ omit }}"
-
should_not_omit_2
== "{{ omit }}suffix"
-
should_not_omit_1
is defined
-
should_not_omit_2
is defined
-
should_not_omit_3 == "__omit_place_holder__afb6b9bc3d20bfeaa00a1b23a5930f89"
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