当前位置: 首页>>代码示例>>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;未经允许,请勿转载。