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
dd1c14a0
Commit
dd1c14a0
authored
Apr 14, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding a method for setting up magic variables from connection info in v2
parent
0fb4520d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
+13
-1
v2/ansible/executor/connection_info.py
+8
-0
v2/ansible/executor/task_executor.py
+5
-1
No files found.
v2/ansible/executor/connection_info.py
View file @
dd1c14a0
...
@@ -261,3 +261,11 @@ class ConnectionInformation:
...
@@ -261,3 +261,11 @@ class ConnectionInformation:
for
field
in
self
.
_get_fields
():
for
field
in
self
.
_get_fields
():
value
=
templar
.
template
(
getattr
(
self
,
field
))
value
=
templar
.
template
(
getattr
(
self
,
field
))
setattr
(
self
,
field
,
value
)
setattr
(
self
,
field
,
value
)
def
update_vars
(
self
,
variables
):
'''
Adds 'magic' variables relating to connections to the variable dictionary provided.
'''
variables
[
'ansible_ssh_port'
]
=
self
.
port
variables
[
'ansible_ssh_user'
]
=
self
.
remote_user
v2/ansible/executor/task_executor.py
View file @
dd1c14a0
...
@@ -193,9 +193,13 @@ class TaskExecutor:
...
@@ -193,9 +193,13 @@ class TaskExecutor:
variables
=
self
.
_job_vars
variables
=
self
.
_job_vars
# fields set from the play/task may be based on variables, so we have to
# fields set from the play/task may be based on variables, so we have to
# do the same kind of post validation step on it here before we use it
# do the same kind of post validation step on it here before we use it
.
self
.
_connection_info
.
post_validate
(
variables
=
variables
,
loader
=
self
.
_loader
)
self
.
_connection_info
.
post_validate
(
variables
=
variables
,
loader
=
self
.
_loader
)
# now that the connection information is finalized, we can add 'magic'
# variables to the variable dictionary
self
.
_connection_info
.
update_vars
(
variables
)
# get the connection and the handler for this execution
# get the connection and the handler for this execution
self
.
_connection
=
self
.
_get_connection
(
variables
)
self
.
_connection
=
self
.
_get_connection
(
variables
)
self
.
_handler
=
self
.
_get_action_handler
(
connection
=
self
.
_connection
)
self
.
_handler
=
self
.
_get_action_handler
(
connection
=
self
.
_connection
)
...
...
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