def get_setting(variable):

    try:
        value = read_json(settings_file)[variable]
    except Exception:
        if variable not in DEFAULTS:
            logger.info("Defaults not found for variable: {}".format(variable))
        value = DEFAULTS[variable]
    return value
Example #2
0
def get_setting(variable):

    try:
        value = read_json(settings_file)[variable]
    except Exception:
        if variable not in DEFAULTS:
            logger.info("Defaults not found for variable: {}".format(variable))
        value = DEFAULTS[variable]
    return value
Example #3
0
def set_chromium_policies(policies):
    if not os.path.exists(chromium_policy_file):
        ensure_dir(os.path.dirname(chromium_policy_file))
        policy_config = {}
    else:
        policy_config = read_json(chromium_policy_file)

    for policy in policies:
        policy_config[policy[0]] = policy[1]

    write_json(chromium_policy_file, policy_config)
def set_setting(variable, value):

    if username == 'root':
        return

    logger.debug(u"config_file / set_setting: {} {}".format(variable, value))

    data = read_json(settings_file)
    if not data:
        data = dict()

    data[variable] = value
    write_json(settings_file, data)
    chown_path(settings_file)
Example #5
0
def set_setting(variable, value):

    if username == 'root':
        return

    logger.debug(u"config_file / set_setting: {} {}".format(variable, value))

    data = read_json(settings_file)
    if not data:
        data = dict()

    data[variable] = value
    write_json(settings_file, data)
    chown_path(settings_file)