Пример #1
0
def _set(name, value):
    """
    :returns: process status
    :rtype: int
    """

    config_path, toml_config = _load_config()

    section, subkey = _split_key(name)

    config_schema = _get_config_schema(section)

    python_value = jsonitem.parse_json_value(subkey, value, config_schema)

    toml_config_pre = copy.deepcopy(toml_config)
    if section not in toml_config_pre._dictionary:
        toml_config_pre._dictionary[section] = {}
    toml_config[name] = python_value

    if (name == 'core.reporting' and python_value is True) or \
       (name == 'core.email'):
        analytics.segment_identify(toml_config)

    _save_config_file(config_path, toml_config)

    _check_config(toml_config_pre, toml_config)

    _save_config_file(config_path, toml_config)
    return 0
Пример #2
0
def _set(name, value):
    """
    :returns: process status
    :rtype: int
    """

    toml_config = config.set_val(name, value)
    if (name == 'core.reporting' is True) or (name == 'core.email'):
        analytics.segment_identify(toml_config)

    return 0
Пример #3
0
def _set(name, value):
    """
    :returns: process status
    :rtype: int
    """

    if name == "package.sources":
        notice = ("This config property has been deprecated. "
                  "Please add your repositories with `dcos package repo add`")
        return DCOSException(notice)
    toml_config = config.set_val(name, value)
    if (name == 'core.reporting' is True) or (name == 'core.email'):
        analytics.segment_identify(toml_config)

    return 0
Пример #4
0
def _set(name, value):
    """
    :returns: process status
    :rtype: int
    """

    if name == "package.sources":
        notice = ("This config property has been deprecated. "
                  "Please add your repositories with `dcos package repo add`")
        return DCOSException(notice)
    toml_config = config.set_val(name, value)
    if (name == 'core.reporting' is True) or (name == 'core.email'):
        analytics.segment_identify(toml_config)

    return 0
Пример #5
0
def _set(name, value):
    """
    :returns: process status
    :rtype: int
    """

    toml_config = util.get_config(True)

    section, subkey = _split_key(name)

    config_schema = _get_config_schema(section)

    new_value = jsonitem.parse_json_value(subkey, value, config_schema)

    toml_config_pre = copy.deepcopy(toml_config)
    if section not in toml_config_pre._dictionary:
        toml_config_pre._dictionary[section] = {}

    value_exists = name in toml_config
    old_value = toml_config.get(name)

    toml_config[name] = new_value

    if (name == 'core.reporting' and new_value is True) or \
       (name == 'core.email'):
        analytics.segment_identify(toml_config)

    _check_config(toml_config_pre, toml_config)

    config.save(toml_config)

    if not value_exists:
        emitter.publish("[{}]: set to '{}'".format(name, new_value))
    elif old_value == new_value:
        emitter.publish("[{}]: already set to '{}'".format(name, old_value))
    else:
        emitter.publish(
            "[{}]: changed from '{}' to '{}'".format(
                name,
                old_value,
                new_value))
    return 0
Пример #6
0
def _set(name, value):
    """
    :returns: process status
    :rtype: int
    """

    toml_config = util.get_config(True)

    section, subkey = _split_key(name)

    config_schema = _get_config_schema(section)

    new_value = jsonitem.parse_json_value(subkey, value, config_schema)

    toml_config_pre = copy.deepcopy(toml_config)
    if section not in toml_config_pre._dictionary:
        toml_config_pre._dictionary[section] = {}

    value_exists = name in toml_config
    old_value = toml_config.get(name)

    toml_config[name] = new_value

    if (name == 'core.reporting' and new_value is True) or \
       (name == 'core.email'):
        analytics.segment_identify(toml_config)

    _check_config(toml_config_pre, toml_config)

    config.save(toml_config)

    if not value_exists:
        emitter.publish("[{}]: set to '{}'".format(name, new_value))
    elif old_value == new_value:
        emitter.publish("[{}]: already set to '{}'".format(name, old_value))
    else:
        emitter.publish("[{}]: changed from '{}' to '{}'".format(
            name, old_value, new_value))
    return 0