def _test_required_attributes(self, resources):
        self.assertTrue(len(resources) > 0)
        for host, attributes in six.iteritems(resources):
            for attribute in self.required_attributes:
                self.assertIn(attribute, attributes)
                self.assertIsNotNone(attributes[attribute])
                self.assertNotEqual(attributes[attribute], "")

            if host == ResourceGenerator._server_node_name:
                expected = self.server_grains
                self.assertIn(host, resources)
                self.assertEqual(resources[host]["hostname"], host)
            else:
                expected = self.mine[host]
                self.assertIn(host, resources)
                self.assertEqual(resources[host]["hostname"], expected["fqdn"])

            self.assertEqual(
                resources[host]["osArch"],
                ResourceGenerator._os_arch(expected["cpuarch"]),
            )
            self.assertEqual(
                resources[host]["osFamily"],
                ResourceGenerator._os_family(expected["kernel"]),
            )
            self.assertEqual(resources[host]["osName"], expected["kernel"])
            self.assertEqual(resources[host]["osVersion"],
                             expected["kernelrelease"])
Exemple #2
0
    def _test_required_attributes(self, resources):
        self.assertTrue(len(resources) > 0)
        for host, attributes in resources.iteritems():
            for attribute in self.required_attributes:
                self.assertIn(attribute, attributes)
                self.assertIsNotNone(attributes[attribute])
                self.assertNotEqual(attributes[attribute], '')

            if host == ResourceGenerator._server_node_name:
                expected = self.server_grains
                self.assertIn(host, resources)
                self.assertEqual(resources[host]['hostname'], host)
            else:
                expected = self.mine[host]
                self.assertIn(host, resources)
                self.assertEqual(
                    resources[host]['hostname'],
                    expected['fqdn'])

            self.assertEqual(
                resources[host]['osArch'],
                ResourceGenerator._os_arch(expected['cpuarch']))
            self.assertEqual(
                resources[host]['osFamily'],
                ResourceGenerator._os_family(expected['kernel']))
            self.assertEqual(
                resources[host]['osName'],
                expected['kernel'])
            self.assertEqual(
                resources[host]['osVersion'],
                expected['kernelrelease'])
Exemple #3
0
 def test_os_family_map1(self):
     os_family = ResourceGenerator._os_family('Linux')
     self.assertEqual(os_family, 'unix')
Exemple #4
0
 def test_os_family_map2(self):
     os_family = ResourceGenerator._os_family('unknown')
     self.assertEqual(os_family, 'unknown')
 def test_os_family_map1(self):
     os_family = ResourceGenerator._os_family("Linux")
     self.assertEqual(os_family, "unix")