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


Python Config.get_config_file方法代码示例

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


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

示例1: test_get_config_file

# 需要导入模块: from xosconfig import Config [as 别名]
# 或者: from xosconfig.Config import get_config_file [as 别名]
 def test_get_config_file(self):
     """
     [XOS-Config] Should return the config file in use
     """
     Config.init(sample_conf)
     res = Config.get_config_file()
     self.assertEqual(res, sample_conf)
开发者ID:opencord,项目名称:xos,代码行数:9,代码来源:test_config.py

示例2: run_playbook

# 需要导入模块: from xosconfig import Config [as 别名]
# 或者: from xosconfig.Config import get_config_file [as 别名]
def run_playbook(ansible_hosts, ansible_config, fqp, opts):
    args = {"ansible_hosts": ansible_hosts,
            "ansible_config": ansible_config,
            "fqp": fqp,
            "opts": opts,
            "config_file": Config.get_config_file()}

    keep_temp_files = Config.get("keep_temp_files")

    dir = tempfile.mkdtemp()
    args_fn = None
    result_fn = None
    try:
        log.info("creating args file",dir = dir)

        args_fn = os.path.join(dir, "args")
        result_fn = os.path.join(dir, "result")

        open(args_fn, "w").write(pickle.dumps(args))

        ansible_main_fn = os.path.join(os.path.dirname(__file__), "ansible_main.py")

        os.system("python %s %s %s" % (ansible_main_fn, args_fn, result_fn))

        result = pickle.loads(open(result_fn).read())

        if hasattr(result, "exception"):
            log.error("Exception in playbook",exception = result["exception"])

        stats = result.get("stats", None)
        aresults = result.get("aresults", None)
    except Exception,e:
        log.exception("Exception running ansible_main")
        stats = None
        aresults = None
开发者ID:vpramo,项目名称:xos-1,代码行数:37,代码来源:ansible_helper.py


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