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
c978c777
Commit
c978c777
authored
Jan 29, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing more v2 bugs
parent
d57f7b4b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
17 deletions
+23
-17
v2/ansible/modules/core
+1
-1
v2/ansible/playbook/conditional.py
+3
-8
v2/ansible/playbook/role/__init__.py
+15
-7
v2/ansible/plugins/connections/ssh.py
+1
-1
v2/ansible/vars/__init__.py
+3
-0
No files found.
core
@
e355f7bf
Subproject commit
256ce9dd4dfbe2b0dc9eb5031812c8ab76418a22
Subproject commit
e355f7bf12465ed3f25a2147d6940179db2a26aa
v2/ansible/playbook/conditional.py
View file @
c978c777
...
...
@@ -53,7 +53,7 @@ class Conditional:
False if any of them evaluate as such.
'''
templar
=
Templar
(
loader
=
self
.
_loader
,
variables
=
all_vars
)
templar
=
Templar
(
loader
=
self
.
_loader
,
variables
=
all_vars
,
fail_on_undefined
=
False
)
for
conditional
in
self
.
when
:
if
not
self
.
_check_conditional
(
conditional
,
templar
,
all_vars
):
return
False
...
...
@@ -69,20 +69,15 @@ class Conditional:
if
conditional
is
None
or
conditional
==
''
:
return
True
# FIXME: is this required? there is no indication what it does
#conditional = conditional.replace("jinja2_compare ","")
# FIXME: this should be removable now, leaving it here just in case
# allow variable names
#if conditional in all_vars and '-' not in str(all_vars[conditional]):
# conditional = all_vars[conditional]
conditional
=
templar
.
template
(
conditional
,
convert_bare
=
True
)
if
not
isinstance
(
conditional
,
basestring
):
if
not
isinstance
(
conditional
,
basestring
)
or
conditional
==
""
:
return
conditional
# FIXME: same as above
#original = str(conditional).replace("jinja2_compare ","")
# a Jinja2 evaluation that results in something Python can eval!
presented
=
"{
%%
if
%
s
%%
} True {
%%
else
%%
} False {
%%
endif
%%
}"
%
conditional
conditional
=
templar
.
template
(
presented
)
...
...
v2/ansible/playbook/role/__init__.py
View file @
c978c777
...
...
@@ -46,13 +46,21 @@ __all__ = ['Role', 'ROLE_CACHE', 'hash_params']
# in a static method. This is also used in the base class for
# strategies (ansible/plugins/strategies/__init__.py)
def
hash_params
(
params
):
s
=
set
()
for
k
,
v
in
params
.
iteritems
():
if
isinstance
(
v
,
dict
):
s
.
update
((
k
,
hash_params
(
v
)))
else
:
s
.
update
((
k
,
v
))
return
frozenset
(
s
)
if
not
isinstance
(
params
,
dict
):
return
params
else
:
s
=
set
()
for
k
,
v
in
params
.
iteritems
():
if
isinstance
(
v
,
dict
):
s
.
update
((
k
,
hash_params
(
v
)))
elif
isinstance
(
v
,
list
):
things
=
[]
for
item
in
v
:
things
.
append
(
hash_params
(
item
))
s
.
update
((
k
,
tuple
(
things
)))
else
:
s
.
update
((
k
,
v
))
return
frozenset
(
s
)
# The role cache is used to prevent re-loading roles, which
# may already exist. Keys into this cache are the SHA1 hash
...
...
v2/ansible/plugins/connections/ssh.py
View file @
c978c777
...
...
@@ -279,7 +279,7 @@ class Connection(ConnectionBase):
# ssh_cmd += ['-6']
ssh_cmd
+=
[
self
.
_host
.
ipv4_address
]
if
not
(
self
.
_connection_info
.
sudo
or
self
.
_connection_info
.
su
)
or
not
sudoable
:
if
not
(
self
.
_connection_info
.
sudo
or
self
.
_connection_info
.
su
):
prompt
=
None
if
executable
:
ssh_cmd
.
append
(
executable
+
' -c '
+
pipes
.
quote
(
cmd
))
...
...
v2/ansible/vars/__init__.py
View file @
c978c777
...
...
@@ -210,6 +210,9 @@ class VariableManager:
hostvars
=
HostVars
(
vars_manager
=
self
,
inventory
=
self
.
_inventory
,
loader
=
loader
)
all_vars
[
'hostvars'
]
=
hostvars
if
self
.
_inventory
is
not
None
:
all_vars
[
'inventory_dir'
]
=
self
.
_inventory
.
basedir
()
# the 'omit' value alows params to be left out if the variable they are based on is undefined
all_vars
[
'omit'
]
=
self
.
_omit_token
...
...
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