當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。