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)
评论列表
文章目录