mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
tests files extensions in group/host_vars dir
only files with extensions as per C.YAML_FILENAME_EXTENSIONS should be parsed
This commit is contained in:
@@ -56,7 +56,7 @@ class TestInventory(unittest.TestCase):
|
||||
'thrudgelmir0', 'thrudgelmir1', 'thrudgelmir2',
|
||||
'thrudgelmir3', 'thrudgelmir4', 'thrudgelmir5',
|
||||
'Hotep-a', 'Hotep-b', 'Hotep-c',
|
||||
'BastC', 'BastD', 'neptun', ]
|
||||
'BastC', 'BastD', 'neptun', 'goldorak', ]
|
||||
|
||||
#####################################
|
||||
### Empty inventory format tests
|
||||
@@ -222,6 +222,11 @@ class TestInventory(unittest.TestCase):
|
||||
inventory.subset('@' + os.path.join(self.test_dir, 'restrict_pattern'))
|
||||
self.assertEqual(sorted(inventory.list_hosts()), sorted(['thor','odin']))
|
||||
|
||||
def test_vars_yaml_extension(self):
|
||||
inventory = self.simple_inventory()
|
||||
vars = inventory.get_variables('goldorak')
|
||||
assert vars['YAML_FILENAME_EXTENSIONS_TEST']
|
||||
|
||||
@raises(errors.AnsibleError)
|
||||
def testinvalid_entry(self):
|
||||
Inventory('1234')
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
YAML_FILENAME_EXTENSIONS_TEST: False
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
YAML_FILENAME_EXTENSIONS_TEST: False
|
||||
2
test/units/inventory_test_data/group_vars/parse/all.yml
Normal file
2
test/units/inventory_test_data/group_vars/parse/all.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
---
|
||||
YAML_FILENAME_EXTENSIONS_TEST: True
|
||||
@@ -20,3 +20,9 @@ Bast[C:D]
|
||||
|
||||
[auth]
|
||||
neptun auth="YWRtaW46YWRtaW4="
|
||||
|
||||
[parse:children]
|
||||
noparse
|
||||
|
||||
[noparse]
|
||||
goldorak
|
||||
|
||||
Reference in New Issue
Block a user