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
6fa1a490
Commit
6fa1a490
authored
Oct 20, 2012
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the basic templating system such that when the template ends in '$', life continues as normal.
parent
6b844805
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
7 deletions
+11
-7
lib/ansible/runner/__init__.py
+1
-4
lib/ansible/runner/connection.py
+2
-3
lib/ansible/utils.py
+2
-0
test/TestUtils.py
+6
-0
No files found.
lib/ansible/runner/__init__.py
View file @
6fa1a490
...
@@ -399,12 +399,9 @@ class Runner(object):
...
@@ -399,12 +399,9 @@ class Runner(object):
actual_host
=
delegate_to
actual_host
=
delegate_to
try
:
try
:
transport
=
None
# use Runner setting
if
delegate_to
and
actual_host
in
[
'127.0.0.1'
,
'localhost'
]:
transport
=
'local'
if
actual_port
is
not
None
:
if
actual_port
is
not
None
:
actual_port
=
int
(
actual_port
)
actual_port
=
int
(
actual_port
)
conn
=
self
.
connector
.
connect
(
actual_host
,
actual_port
,
transport
=
transport
)
conn
=
self
.
connector
.
connect
(
actual_host
,
actual_port
)
if
delegate_to
:
if
delegate_to
:
conn
.
delegate
=
host
conn
.
delegate
=
host
...
...
lib/ansible/runner/connection.py
View file @
6fa1a490
...
@@ -40,13 +40,12 @@ class Connection(object):
...
@@ -40,13 +40,12 @@ class Connection(object):
self
.
runner
=
runner
self
.
runner
=
runner
self
.
modules
=
None
self
.
modules
=
None
def
connect
(
self
,
host
,
port
,
transport
=
None
):
def
connect
(
self
,
host
,
port
):
if
self
.
modules
is
None
:
if
self
.
modules
is
None
:
self
.
modules
=
modules
.
copy
()
self
.
modules
=
modules
.
copy
()
self
.
modules
.
update
(
utils
.
import_plugins
(
os
.
path
.
join
(
self
.
runner
.
basedir
,
'connection_plugins'
)))
self
.
modules
.
update
(
utils
.
import_plugins
(
os
.
path
.
join
(
self
.
runner
.
basedir
,
'connection_plugins'
)))
conn
=
None
conn
=
None
if
transport
is
None
:
transport
=
self
.
runner
.
transport
transport
=
self
.
runner
.
transport
module
=
self
.
modules
.
get
(
transport
,
None
)
module
=
self
.
modules
.
get
(
transport
,
None
)
if
module
is
None
:
if
module
is
None
:
raise
AnsibleError
(
"unsupported connection type:
%
s"
%
transport
)
raise
AnsibleError
(
"unsupported connection type:
%
s"
%
transport
)
...
...
lib/ansible/utils.py
View file @
6fa1a490
...
@@ -246,6 +246,8 @@ def _varFind(text):
...
@@ -246,6 +246,8 @@ def _varFind(text):
if
start
==
-
1
:
if
start
==
-
1
:
return
None
return
None
var_start
=
start
+
1
var_start
=
start
+
1
if
var_start
>=
len
(
text
):
return
None
if
text
[
var_start
]
==
'{'
:
if
text
[
var_start
]
==
'{'
:
is_complex
=
True
is_complex
=
True
brace_level
=
1
brace_level
=
1
...
...
test/TestUtils.py
View file @
6fa1a490
...
@@ -19,6 +19,12 @@ class TestUtils(unittest.TestCase):
...
@@ -19,6 +19,12 @@ class TestUtils(unittest.TestCase):
assert
res
==
'hello world'
assert
res
==
'hello world'
def
test_varReplace_trailing_dollar
(
self
):
template
=
'$what $who $'
vars
=
dict
(
what
=
'hello'
,
who
=
'world'
)
res
=
ansible
.
utils
.
varReplace
(
template
,
vars
)
assert
res
==
'hello world $'
def
test_varReplace_multiple
(
self
):
def
test_varReplace_multiple
(
self
):
template
=
'$what $who'
template
=
'$what $who'
vars
=
{
vars
=
{
...
...
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