Merge pull request #4351 from 2m/leading-range-fix

Allow leading ranges in the inventory host entries.
This commit is contained in:
jctanner
2013-11-13 10:48:57 -08:00
4 changed files with 22 additions and 6 deletions

View File

@@ -294,6 +294,16 @@ class TestInventory(unittest.TestCase):
expected_hosts=['host1A','host2A','host1B','host2B']
assert sorted(hosts) == sorted(expected_hosts)
def test_leading_range(self):
i = Inventory(os.path.join(self.test_dir, 'inventory','test_leading_range'))
hosts = i.list_hosts('test')
expected_hosts=['1.host','2.host','A.host','B.host']
assert sorted(hosts) == sorted(expected_hosts)
hosts2 = i.list_hosts('test2')
expected_hosts2=['1.host','2.host','3.host']
assert sorted(hosts2) == sorted(expected_hosts2)
###################################################
### Inventory API tests

View File

@@ -0,0 +1,6 @@
[test]
[1:2].host
[A:B].host
[test2] # comment
[1:3].host