当前位置: 首页>>代码示例>>Python>>正文


Python OOConfig.get_host方法代码示例

本文整理汇总了Python中ooinstall.oo_config.OOConfig.get_host方法的典型用法代码示例。如果您正苦于以下问题:Python OOConfig.get_host方法的具体用法?Python OOConfig.get_host怎么用?Python OOConfig.get_host使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ooinstall.oo_config.OOConfig的用法示例。


在下文中一共展示了OOConfig.get_host方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: LegacyOOConfigTests

# 需要导入模块: from ooinstall.oo_config import OOConfig [as 别名]
# 或者: from ooinstall.oo_config.OOConfig import get_host [as 别名]
class LegacyOOConfigTests(OOInstallFixture):

    def setUp(self):
        OOInstallFixture.setUp(self)
        self.cfg_path = self.write_config(os.path.join(self.work_dir,
            'ooinstall.conf'), LEGACY_CONFIG)
        self.cfg = OOConfig(self.cfg_path)

    def test_load_config_memory(self):
        self.assertEquals('openshift-enterprise', self.cfg.settings['variant'])
        self.assertEquals('3.0', self.cfg.settings['variant_version'])
        self.assertEquals('v1', self.cfg.settings['version'])

        self.assertEquals(3, len(self.cfg.hosts))
        h1 = self.cfg.get_host('10.0.0.1')
        self.assertEquals('10.0.0.1', h1.ip)
        self.assertEquals('24.222.0.1', h1.public_ip)
        self.assertEquals('master-private.example.com', h1.hostname)
        self.assertEquals('master.example.com', h1.public_hostname)

        h2 = self.cfg.get_host('10.0.0.2')
        self.assertEquals('10.0.0.2', h2.ip)
        self.assertEquals('24.222.0.2', h2.public_ip)
        self.assertEquals('node1-private.example.com', h2.hostname)
        self.assertEquals('node1.example.com', h2.public_hostname)

        h3 = self.cfg.get_host('10.0.0.3')
        self.assertEquals('10.0.0.3', h3.ip)
        self.assertEquals('24.222.0.3', h3.public_ip)
        self.assertEquals('node2-private.example.com', h3.hostname)
        self.assertEquals('node2.example.com', h3.public_hostname)

        self.assertFalse('masters' in self.cfg.settings)
        self.assertFalse('nodes' in self.cfg.settings)
        self.assertFalse('Description' in self.cfg.settings)
        self.assertFalse('Name' in self.cfg.settings)
        self.assertFalse('Subscription' in self.cfg.settings)
        self.assertFalse('Vendor' in self.cfg.settings)
        self.assertFalse('Version' in self.cfg.settings)
        self.assertFalse('validates_facts' in self.cfg.settings)
开发者ID:ReSearchITEng,项目名称:openshift-ansible,代码行数:42,代码来源:oo_config_tests.py

示例2: LegacyOOConfigTests

# 需要导入模块: from ooinstall.oo_config import OOConfig [as 别名]
# 或者: from ooinstall.oo_config.OOConfig import get_host [as 别名]
class LegacyOOConfigTests(OOInstallFixture):
    def setUp(self):
        OOInstallFixture.setUp(self)
        self.cfg_path = self.write_config(os.path.join(self.work_dir, "ooinstall.conf"), LEGACY_CONFIG)
        self.cfg = OOConfig(self.cfg_path)

    def test_load_config_memory(self):
        self.assertEquals("openshift-enterprise", self.cfg.settings["variant"])
        self.assertEquals("3.0", self.cfg.settings["variant_version"])
        self.assertEquals("v1", self.cfg.settings["version"])

        self.assertEquals(3, len(self.cfg.hosts))
        h1 = self.cfg.get_host("10.0.0.1")
        self.assertEquals("10.0.0.1", h1.ip)
        self.assertEquals("24.222.0.1", h1.public_ip)
        self.assertEquals("master-private.example.com", h1.hostname)
        self.assertEquals("master.example.com", h1.public_hostname)

        h2 = self.cfg.get_host("10.0.0.2")
        self.assertEquals("10.0.0.2", h2.ip)
        self.assertEquals("24.222.0.2", h2.public_ip)
        self.assertEquals("node1-private.example.com", h2.hostname)
        self.assertEquals("node1.example.com", h2.public_hostname)

        h3 = self.cfg.get_host("10.0.0.3")
        self.assertEquals("10.0.0.3", h3.ip)
        self.assertEquals("24.222.0.3", h3.public_ip)
        self.assertEquals("node2-private.example.com", h3.hostname)
        self.assertEquals("node2.example.com", h3.public_hostname)

        self.assertFalse("masters" in self.cfg.settings)
        self.assertFalse("nodes" in self.cfg.settings)
        self.assertFalse("Description" in self.cfg.settings)
        self.assertFalse("Name" in self.cfg.settings)
        self.assertFalse("Subscription" in self.cfg.settings)
        self.assertFalse("Vendor" in self.cfg.settings)
        self.assertFalse("Version" in self.cfg.settings)
        self.assertFalse("validates_facts" in self.cfg.settings)
开发者ID:jmarley,项目名称:openshift-ansible,代码行数:40,代码来源:oo_config_tests.py


注:本文中的ooinstall.oo_config.OOConfig.get_host方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。