|
|
|
@ -75,6 +75,9 @@ class TestVariableManager(unittest.TestCase):
|
|
|
|
|
foo: bam
|
|
|
|
|
baa: bat
|
|
|
|
|
""",
|
|
|
|
|
"host_vars/host.name.yml": """
|
|
|
|
|
host_with_dots: true
|
|
|
|
|
""",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
v = VariableManager()
|
|
|
|
@ -92,6 +95,9 @@ class TestVariableManager(unittest.TestCase):
|
|
|
|
|
self.assertEqual(v.get_vars(loader=fake_loader, host=mock_host, use_cache=False).get("foo"), "bam")
|
|
|
|
|
self.assertEqual(v.get_vars(loader=fake_loader, host=mock_host, use_cache=False).get("baa"), "bat")
|
|
|
|
|
|
|
|
|
|
v.add_host_vars_file("host_vars/host.name", loader=fake_loader)
|
|
|
|
|
self.assertEqual(v._host_vars_files["host.name"], [dict(host_with_dots=True)])
|
|
|
|
|
|
|
|
|
|
def test_variable_manager_group_vars_file(self):
|
|
|
|
|
fake_loader = DictDataLoader({
|
|
|
|
|
"group_vars/all.yml": """
|
|
|
|
@ -102,7 +108,10 @@ class TestVariableManager(unittest.TestCase):
|
|
|
|
|
""",
|
|
|
|
|
"other_path/group_vars/somegroup.yml": """
|
|
|
|
|
baa: bat
|
|
|
|
|
"""
|
|
|
|
|
""",
|
|
|
|
|
"group_vars/some.group.yml": """
|
|
|
|
|
group_with_dots: true
|
|
|
|
|
""",
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
v = VariableManager()
|
|
|
|
@ -128,6 +137,9 @@ class TestVariableManager(unittest.TestCase):
|
|
|
|
|
self.assertEqual(vars.get("foo"), "bar")
|
|
|
|
|
self.assertEqual(vars.get("baa"), "bat")
|
|
|
|
|
|
|
|
|
|
v.add_group_vars_file("group_vars/some.group", loader=fake_loader)
|
|
|
|
|
self.assertEqual(v._group_vars_files["some.group"], [dict(group_with_dots=True)])
|
|
|
|
|
|
|
|
|
|
def test_variable_manager_play_vars(self):
|
|
|
|
|
fake_loader = DictDataLoader({})
|
|
|
|
|
|
|
|
|
|