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
d34b586e
Commit
d34b586e
authored
May 05, 2015
by
James Cammarata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability for connection plugins to set attributes based on host variables (v2)
parent
8fae2abe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
1 deletions
+14
-1
lib/ansible/executor/task_executor.py
+3
-1
lib/ansible/plugins/connections/__init__.py
+11
-0
No files found.
lib/ansible/executor/task_executor.py
View file @
d34b586e
...
...
@@ -209,7 +209,9 @@ class TaskExecutor:
# get the connection and the handler for this execution
self
.
_connection
=
self
.
_get_connection
(
variables
)
self
.
_handler
=
self
.
_get_action_handler
(
connection
=
self
.
_connection
,
templar
=
templar
)
self
.
_connection
.
set_host_overrides
(
host
=
self
.
_host
)
self
.
_handler
=
self
.
_get_action_handler
(
connection
=
self
.
_connection
,
templar
=
templar
)
# Evaluate the conditional (if any) for this task, which we do before running
# the final task post-validation. We do this before the post validation due to
...
...
lib/ansible/plugins/connections/__init__.py
View file @
d34b586e
...
...
@@ -64,6 +64,17 @@ class ConnectionBase:
raise
AnsibleError
(
"Internal Error: this connection module does not support running commands via
%
s"
%
become_method
)
def
set_host_overrides
(
self
,
host
):
'''
An optional method, which can be used to set connection plugin parameters
from variables set on the host (or groups to which the host belongs)
Any connection plugin using this should first initialize its attributes in
an overridden `def __init__(self):`, and then use `host.get_vars()` to find
variables which may be used to set those attributes in this method.
'''
pass
@abstractproperty
def
transport
(
self
):
"""String used to identify this Connection class from other classes"""
...
...
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