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
1f8696f5
Commit
1f8696f5
authored
Sep 11, 2012
by
John Kleint
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix inventory.get_hosts when hosts is a list.
parent
565f3361
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
lib/ansible/inventory/__init__.py
+3
-1
test/TestInventory.py
+8
-0
No files found.
lib/ansible/inventory/__init__.py
View file @
1f8696f5
...
...
@@ -96,7 +96,9 @@ class Inventory(object):
applied subsets.
"""
# process patterns
# process patterns
if
isinstance
(
pattern
,
list
):
pattern
=
';'
.
join
(
pattern
)
patterns
=
pattern
.
replace
(
";"
,
":"
)
.
split
(
":"
)
positive_patterns
=
[
p
for
p
in
patterns
if
not
p
.
startswith
(
"!"
)
]
negative_patterns
=
[
p
for
p
in
patterns
if
p
.
startswith
(
"!"
)
]
...
...
test/TestInventory.py
View file @
1f8696f5
...
...
@@ -238,3 +238,11 @@ class TestInventory(unittest.TestCase):
'group_names'
:
[
'norse'
],
'inventory_hostname'
:
'thor'
,
'inventory_hostname_short'
:
'thor'
}
def
test_hosts_list
(
self
):
"""Test the case when playbook 'hosts' var is a list."""
inventory
=
self
.
script_inventory
()
host_names
=
sorted
([
'thor'
,
'loki'
,
'odin'
])
# Not sure if sorting is in the contract or not
actual_hosts
=
inventory
.
get_hosts
(
host_names
)
actual_host_names
=
[
host
.
name
for
host
in
actual_hosts
]
assert
host_names
==
actual_host_names
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