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
fbda2d46
Commit
fbda2d46
authored
Nov 01, 2012
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use default port if ansible_ssh_port is not set for the delegated node
Also add testcase for it.
parent
be300b56
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
+23
-5
lib/ansible/runner/__init__.py
+2
-0
test/TestPlayBook.py
+10
-3
test/alias_hosts
+3
-1
test/alias_playbook.yml
+8
-1
No files found.
lib/ansible/runner/__init__.py
View file @
fbda2d46
...
...
@@ -384,6 +384,7 @@ class Runner(object):
interpreters
.
append
(
i
)
for
i
in
interpreters
:
del
inject
[
i
]
port
=
C
.
DEFAULT_REMOTE_PORT
try
:
delegate_info
=
inject
[
'hostvars'
][
delegate_to
]
actual_host
=
delegate_info
.
get
(
'ansible_ssh_host'
,
delegate_to
)
...
...
@@ -393,6 +394,7 @@ class Runner(object):
inject
[
i
]
=
delegate_info
[
i
]
except
errors
.
AnsibleError
:
actual_host
=
delegate_to
actual_port
=
port
try
:
if
actual_port
is
not
None
:
...
...
test/TestPlayBook.py
View file @
fbda2d46
...
...
@@ -160,12 +160,19 @@ class TestPlaybook(unittest.TestCase):
actual
=
self
.
_run
(
pb
,
'test/alias_hosts'
)
expected
=
{
"alias-node.example.com"
:
{
"changed"
:
3
,
"changed"
:
5
,
"failures"
:
0
,
"ok"
:
4
,
"ok"
:
6
,
"skipped"
:
1
,
"unreachable"
:
0
,
}
},
"other-alias-node.example.com"
:
{
"changed"
:
1
,
"failures"
:
0
,
"ok"
:
1
,
"skipped"
:
0
,
"unreachable"
:
1
,
},
}
assert
utils
.
jsonify
(
expected
,
format
=
True
)
==
utils
.
jsonify
(
actual
,
format
=
True
)
...
...
test/alias_hosts
View file @
fbda2d46
other-alias-node.example.com ansible_ssh_host=localhost ansible_ssh_port=28848
[aliasgroup]
alias-node.example.com ansible_ssh_host=localhost
ansible_ssh_port=22
alias-node.example.com ansible_ssh_host=localhost
test/alias_playbook.yml
View file @
fbda2d46
---
-
hosts
:
al
l
-
hosts
:
al
iasgroup
vars
:
test_file
:
/tmp/ansible-alias-test
tasks
:
...
...
@@ -7,3 +7,10 @@
-
action
:
command creates=$test_file
false
-
local_action
:
command
true
-
action
:
command removes=$test_file rm -f $test_file
-
hosts
:
all
gather_facts
:
False
tasks
:
-
action
:
command
true
delegate_to
:
alias-node.example.com
-
action
:
command
true
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