config.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:deb-python-dcos 作者: openstack 项目源码 文件源码
def get_config_schema(command):
    """
    :param command: the subcommand name
    :type command: str
    :returns: the subcommand's configuration schema
    :rtype: dict
    """

    # import here to avoid circular import
    from dcos.subcommand import (
            command_executables, config_schema, default_subcommands)

    # core.* config variables are special.  They're valid, but don't
    # correspond to any particular subcommand, so we must handle them
    # separately.
    if command == "core":
        return json.loads(
            pkg_resources.resource_string(
                'dcos',
                'data/config-schema/core.json').decode('utf-8'))
    elif command in default_subcommands():
        return json.loads(
            pkg_resources.resource_string(
                'dcos',
                'data/config-schema/{}.json'.format(command)).decode('utf-8'))
    else:
        executable = command_executables(command)
        return config_schema(executable, command)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号