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
713f5ab7
Commit
713f5ab7
authored
Sep 17, 2015
by
Abhijit Menon-Sen
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1 from mcsalgado/hostpatterns
More tests, better handling of list arguments to _split_pattern
parents
349eec78
14fefeba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
lib/ansible/inventory/__init__.py
+2
-3
test/units/inventory/test_inventory.py
+11
-0
No files found.
lib/ansible/inventory/__init__.py
View file @
713f5ab7
...
...
@@ -24,6 +24,7 @@ import os
import
sys
import
re
import
stat
import
itertools
from
ansible
import
constants
as
C
from
ansible.errors
import
AnsibleError
...
...
@@ -185,9 +186,7 @@ class Inventory(object):
"""
if
isinstance
(
pattern
,
list
):
pattern
=
','
.
join
(
pattern
)
patterns
=
[]
return
list
(
itertools
.
chain
(
*
map
(
self
.
_split_pattern
,
pattern
)))
if
';'
in
pattern
:
display
.
deprecated
(
"Use ',' instead of ':' or ';' to separate host patterns"
,
version
=
2.0
,
removed
=
True
)
...
...
test/units/inventory/test_inventory.py
View file @
713f5ab7
...
...
@@ -44,6 +44,14 @@ class TestInventory(unittest.TestCase):
' a : b '
:
[
'a'
,
'b'
],
'foo:bar:baz[1:2]'
:
[
'foo'
,
'bar'
,
'baz[1:2]'
],
}
pattern_lists
=
[
[[
'a'
],
[
'a'
]],
[[
'a'
,
'b'
],
[
'a'
,
'b'
]],
[[
'a, b'
],
[
'a'
,
'b'
]],
[[
'9a01:7f8:191:7701::9'
,
'9a01:7f8:191:7701::9,foo'
],
[
'9a01:7f8:191:7701::9'
,
'9a01:7f8:191:7701::9'
,
'foo'
]]
]
def
setUp
(
self
):
v
=
VariableManager
()
...
...
@@ -56,3 +64,6 @@ class TestInventory(unittest.TestCase):
for
p
in
self
.
patterns
:
r
=
self
.
patterns
[
p
]
self
.
assertEqual
(
r
,
self
.
i
.
_split_pattern
(
p
))
for
p
,
r
in
self
.
pattern_lists
:
self
.
assertEqual
(
r
,
self
.
i
.
_split_pattern
(
p
))
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