Example #1
0
def _save_auth_keys(key_dict):
    """
    :param key_dict: auth parameters dict
    :type key_dict: dict
    :rtype: None
    """

    config_path = os.environ[constants.DCOS_CONFIG_ENV]
    toml_config = config.mutable_load_from_path(config_path)

    section = 'core'
    config_schema = json.loads(
        pkg_resources.resource_string(
            'dcoscli',
            'data/config-schema/core.json').decode('utf-8'))
    for k, v in iteritems(key_dict):
        python_value = jsonitem.parse_json_value(k, v, config_schema)
        name = '{}.{}'.format(section, k)
        toml_config[name] = python_value

    serial = toml.dumps(toml_config._dictionary)
    with util.open_file(config_path, 'w') as config_file:
        config_file.write(serial)

    return None
Example #2
0
def _load_config():
    """
    :returns: process status
    :rtype: int
    """

    config_path = os.environ[constants.DCOS_CONFIG_ENV]
    return (config_path, config.mutable_load_from_path(config_path))