mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-01 22:09:08 -07:00
Avoid range selection on empty groups
This prevents a traceback when the group is empty. Fixes #6258
This commit is contained in:
parent
07495ed29e
commit
0c2c37a47a
2 changed files with 11 additions and 0 deletions
|
@ -212,6 +212,11 @@ class TestInventory(unittest.TestCase):
|
|||
inventory.subset('greek[0-2];norse[0]')
|
||||
self.assertEqual(sorted(inventory.list_hosts()), sorted(['zeus','hera','thor']))
|
||||
|
||||
def test_subet_range_empty_group(self):
|
||||
inventory = self.simple_inventory()
|
||||
inventory.subset('missing[0]')
|
||||
self.assertEqual(sorted(inventory.list_hosts()), sorted([]))
|
||||
|
||||
def test_subset_filename(self):
|
||||
inventory = self.simple_inventory()
|
||||
inventory.subset('@' + os.path.join(self.test_dir, 'restrict_pattern'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue