當前位置: 首頁>>代碼示例>>Python>>正文


Python OOConfig.save_to_disk方法代碼示例

本文整理匯總了Python中ooinstall.oo_config.OOConfig.save_to_disk方法的典型用法代碼示例。如果您正苦於以下問題:Python OOConfig.save_to_disk方法的具體用法?Python OOConfig.save_to_disk怎麽用?Python OOConfig.save_to_disk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ooinstall.oo_config.OOConfig的用法示例。


在下文中一共展示了OOConfig.save_to_disk方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_write_config

# 需要導入模塊: from ooinstall.oo_config import OOConfig [as 別名]
# 或者: from ooinstall.oo_config.OOConfig import save_to_disk [as 別名]
    def test_write_config(self):
        cfg_path = self.write_config(os.path.join(self.work_dir,
            'ooinstall.conf'), SAMPLE_CONFIG)
        ooconfig = OOConfig(cfg_path)
        ooconfig.save_to_disk()

        f = open(cfg_path, 'r')
        written_config = yaml.safe_load(f.read())
        f.close()



        self.assertEquals(3, len(written_config['deployment']['hosts']))
        for h in written_config['deployment']['hosts']:
            self.assertTrue('ip' in h)
            self.assertTrue('public_ip' in h)
            self.assertTrue('hostname' in h)
            self.assertTrue('public_hostname' in h)

        self.assertTrue('ansible_ssh_user' in written_config['deployment'])
        self.assertTrue('variant' in written_config)
        self.assertEquals('v2', written_config['version'])

        # Some advanced settings should not get written out if they
        # were not specified by the user:
        self.assertFalse('ansible_inventory_directory' in written_config)
開發者ID:dumdan,項目名稱:openshift-ansible,代碼行數:28,代碼來源:oo_config_tests.py

示例2: test_write_config

# 需要導入模塊: from ooinstall.oo_config import OOConfig [as 別名]
# 或者: from ooinstall.oo_config.OOConfig import save_to_disk [as 別名]
    def test_write_config(self):
        cfg_path = self.write_config(os.path.join(self.work_dir, "ooinstall.conf"), SAMPLE_CONFIG)
        ooconfig = OOConfig(cfg_path)
        ooconfig.save_to_disk()

        f = open(cfg_path, "r")
        written_config = yaml.safe_load(f.read())
        f.close()

        self.assertEquals(3, len(written_config["hosts"]))
        for h in written_config["hosts"]:
            self.assertTrue("ip" in h)
            self.assertTrue("public_ip" in h)
            self.assertTrue("hostname" in h)
            self.assertTrue("public_hostname" in h)

        self.assertTrue("ansible_ssh_user" in written_config)
        self.assertTrue("variant" in written_config)
        self.assertEquals("v1", written_config["version"])

        # Some advanced settings should not get written out if they
        # were not specified by the user:
        self.assertFalse("ansible_inventory_directory" in written_config)
開發者ID:jmarley,項目名稱:openshift-ansible,代碼行數:25,代碼來源:oo_config_tests.py


注:本文中的ooinstall.oo_config.OOConfig.save_to_disk方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。