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
5a65dc3b
Commit
5a65dc3b
authored
Apr 04, 2014
by
James Tanner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #6820 fix erroneous missing vault password error when using the template module
parent
466ab0a9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
6 deletions
+6
-6
lib/ansible/runner/__init__.py
+4
-3
lib/ansible/runner/action_plugins/template.py
+1
-1
lib/ansible/utils/template.py
+1
-1
lib/ansible/utils/vault.py
+0
-1
No files found.
lib/ansible/runner/__init__.py
View file @
5a65dc3b
...
...
@@ -83,15 +83,16 @@ def _executor_hook(job_queue, result_queue, new_stdin):
class
HostVars
(
dict
):
''' A special view of vars_cache that adds values from the inventory when needed. '''
def
__init__
(
self
,
vars_cache
,
inventory
):
def
__init__
(
self
,
vars_cache
,
inventory
,
vault_password
=
None
):
self
.
vars_cache
=
vars_cache
self
.
inventory
=
inventory
self
.
lookup
=
dict
()
self
.
update
(
vars_cache
)
self
.
vault_password
=
vault_password
def
__getitem__
(
self
,
host
):
if
host
not
in
self
.
lookup
:
result
=
self
.
inventory
.
get_variables
(
host
)
result
=
self
.
inventory
.
get_variables
(
host
,
vault_password
=
self
.
vault_password
)
result
.
update
(
self
.
vars_cache
.
get
(
host
,
{}))
self
.
lookup
[
host
]
=
result
return
self
.
lookup
[
host
]
...
...
@@ -563,7 +564,7 @@ class Runner(object):
inject
=
utils
.
combine_vars
(
inject
,
module_vars
)
inject
=
utils
.
combine_vars
(
inject
,
combined_cache
.
get
(
host
,
{}))
inject
.
setdefault
(
'ansible_ssh_user'
,
self
.
remote_user
)
inject
[
'hostvars'
]
=
HostVars
(
combined_cache
,
self
.
inventory
)
inject
[
'hostvars'
]
=
HostVars
(
combined_cache
,
self
.
inventory
,
vault_password
=
self
.
vault_pass
)
inject
[
'group_names'
]
=
host_variables
.
get
(
'group_names'
,
[])
inject
[
'groups'
]
=
self
.
inventory
.
groups_list
()
inject
[
'vars'
]
=
self
.
module_vars
...
...
lib/ansible/runner/action_plugins/template.py
View file @
5a65dc3b
...
...
@@ -85,7 +85,7 @@ class ActionModule(object):
# template the source data locally & get ready to transfer
try
:
resultant
=
template
.
template_from_file
(
self
.
runner
.
basedir
,
source
,
inject
)
resultant
=
template
.
template_from_file
(
self
.
runner
.
basedir
,
source
,
inject
,
vault_password
=
self
.
runner
.
vault_pass
)
except
Exception
,
e
:
result
=
dict
(
failed
=
True
,
msg
=
str
(
e
))
return
ReturnData
(
conn
=
conn
,
comm_ok
=
False
,
result
=
result
)
...
...
lib/ansible/utils/template.py
View file @
5a65dc3b
...
...
@@ -199,7 +199,7 @@ class J2Template(jinja2.environment.Template):
def
new_context
(
self
,
vars
=
None
,
shared
=
False
,
locals
=
None
):
return
jinja2
.
runtime
.
Context
(
self
.
environment
,
vars
.
add_locals
(
locals
),
self
.
name
,
self
.
blocks
)
def
template_from_file
(
basedir
,
path
,
vars
):
def
template_from_file
(
basedir
,
path
,
vars
,
vault_password
=
None
):
''' run a file through the templating engine '''
fail_on_undefined
=
C
.
DEFAULT_UNDEFINED_VAR_BEHAVIOR
...
...
lib/ansible/utils/vault.py
View file @
5a65dc3b
...
...
@@ -451,7 +451,6 @@ class VaultAES256(object):
derivedkey
=
PBKDF2
(
password
,
salt
,
dkLen
=
(
2
*
keylength
)
+
ivlength
,
count
=
10000
,
prf
=
pbkdf2_prf
)
#import epdb; epdb.st()
key1
=
derivedkey
[:
keylength
]
key2
=
derivedkey
[
keylength
:(
keylength
*
2
)]
iv
=
derivedkey
[(
keylength
*
2
):(
keylength
*
2
)
+
ivlength
]
...
...
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