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
daf79780
Commit
daf79780
authored
Dec 14, 2012
by
Junegunn Choi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allows whitespaces around assignment operators
when defining group variables
parent
23f2a7fc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
3 deletions
+15
-3
lib/ansible/inventory/ini.py
+6
-2
test/TestInventory.py
+3
-1
test/complex_hosts
+6
-0
No files found.
lib/ansible/inventory/ini.py
View file @
daf79780
...
...
@@ -24,6 +24,7 @@ from ansible.inventory.expand_hosts import detect_range
from
ansible.inventory.expand_hosts
import
expand_hostname_range
from
ansible
import
errors
import
shlex
import
re
class
InventoryParser
(
object
):
"""
...
...
@@ -167,5 +168,8 @@ class InventoryParser(object):
if
line
.
find
(
"="
)
==
-
1
:
raise
errors
.
AnsibleError
(
"variables assigned to group must be in key=value form"
)
else
:
(
k
,
v
)
=
line
.
split
(
"="
,
1
)
group
.
set_variable
(
k
,
v
)
(
k
,
v
)
=
[
e
.
strip
()
for
e
in
line
.
split
(
"="
,
1
)]
if
re
.
match
(
r"^(['\"]).*\1$"
,
v
):
group
.
set_variable
(
k
,
re
.
sub
(
r"^['\"]|['\"]$"
,
''
,
v
))
else
:
group
.
set_variable
(
k
,
v
)
test/TestInventory.py
View file @
daf79780
...
...
@@ -142,7 +142,9 @@ class TestInventory(unittest.TestCase):
print
vars
expected
=
dict
(
a
=
'1'
,
b
=
'2'
,
c
=
'3'
,
d
=
'10002'
,
rga
=
'1'
,
rgb
=
'2'
,
rgc
=
'3'
,
a
=
'1'
,
b
=
'2'
,
c
=
'3'
,
d
=
'10002'
,
e
=
'10003'
,
f
=
'10004 != 10005'
,
g
=
' g '
,
h
=
' h '
,
i
=
"' i
\"
"
,
j
=
'" j'
,
rga
=
'1'
,
rgb
=
'2'
,
rgc
=
'3'
,
inventory_hostname
=
'rtp_a'
,
inventory_hostname_short
=
'rtp_a'
,
group_names
=
[
'eastcoast'
,
'nc'
,
'redundantgroup'
,
'redundantgroup2'
,
'redundantgroup3'
,
'rtp'
,
'us'
]
)
...
...
test/complex_hosts
View file @
daf79780
...
...
@@ -34,6 +34,12 @@ rgc=3
b=10000
c=10001
d=10002
e = 10003
f = 10004 != 10005
g = " g "
h = ' h '
i = ' i "
j = " j
[rtp]
rtp_a
...
...
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