Пример #1
0
    def test_nested_one_level_populates_other_groups(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'hosts')
        contents = """
        [mons:children]
        atlanta

        [atlanta]
        mon0
        """
        make_hosts_file(filename, contents)
        result = configuration.AnsibleInventoryParser(filename).nodes
        assert result['mons'][0]['host'] == 'mon0'
Пример #2
0
    def test_ignores_unknown_groups(self, tmpdir):
        filename = os.path.join(str(tmpdir), 'hosts')
        contents = """
        [mons]
        mon0

        [test]
        node1
        """
        make_hosts_file(filename, contents)
        result = configuration.AnsibleInventoryParser(filename).nodes
        assert 'test' not in result
Пример #3
0
 def test_populates_hosts(self, tmpdir):
     filename = os.path.join(str(tmpdir), 'hosts')
     make_hosts_file(filename)
     result = configuration.AnsibleInventoryParser(filename).nodes
     assert result['mons'][0]['host'] == 'mon0'
     assert result['osds'][0]['host'] == 'osd0'
Пример #4
0
 def test_hosts_do_not_get_mixed(self, tmpdir):
     filename = os.path.join(str(tmpdir), 'hosts')
     make_hosts_file(filename)
     result = configuration.AnsibleInventoryParser(filename).nodes
     assert len(result['mons']) == 1
     assert len(result['osds']) == 1
Пример #5
0
 def test_parses_both_sections(self, tmpdir):
     filename = os.path.join(str(tmpdir), 'hosts')
     make_hosts_file(filename)
     result = configuration.AnsibleInventoryParser(filename)
     assert sorted(result.nodes.keys()) == sorted(['mons', 'osds'])