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
0c70abfa
Commit
0c70abfa
authored
Nov 25, 2012
by
Daniel Hokka Zakrisson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure any existing groups gets reused
parent
5504f13c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
lib/ansible/inventory/ini.py
+3
-2
test/TestInventory.py
+1
-1
No files found.
lib/ansible/inventory/ini.py
View file @
0c70abfa
...
...
@@ -67,9 +67,10 @@ class InventoryParser(object):
active_group_name
=
line
.
replace
(
"["
,
""
)
.
replace
(
"]"
,
""
)
.
strip
()
if
line
.
find
(
":vars"
)
!=
-
1
or
line
.
find
(
":children"
)
!=
-
1
:
active_group_name
=
active_group_name
.
rsplit
(
":"
,
1
)[
0
]
self
.
groups
[
active_group_name
]
=
Group
(
name
=
active_group_name
)
if
active_group_name
not
in
self
.
groups
:
self
.
groups
[
active_group_name
]
=
Group
(
name
=
active_group_name
)
active_group_name
=
None
el
se
:
el
if
active_group_name
not
in
self
.
groups
:
new_group
=
self
.
groups
[
active_group_name
]
=
Group
(
name
=
active_group_name
)
all
.
add_child_group
(
new_group
)
elif
line
.
startswith
(
"#"
)
or
line
==
''
:
...
...
test/TestInventory.py
View file @
0c70abfa
...
...
@@ -142,7 +142,7 @@ class TestInventory(unittest.TestCase):
print
vars
expected
=
dict
(
a
=
'1'
,
b
=
'2'
,
c
=
'3'
,
d
=
'1000
0
2'
,
rga
=
'1'
,
rgb
=
'2'
,
rgc
=
'3'
,
a
=
'1'
,
b
=
'2'
,
c
=
'3'
,
d
=
'10002'
,
rga
=
'1'
,
rgb
=
'2'
,
rgc
=
'3'
,
inventory_hostname
=
'rtp_a'
,
inventory_hostname_short
=
'rtp_a'
,
group_names
=
[
'eastcoast'
,
'nc'
,
'redundantgroup'
,
'redundantgroup2'
,
'redundantgroup3'
,
'rtp'
,
'us'
]
)
...
...
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