예제 #1
0
파일: option.py 프로젝트: yodermk/holland
def merge_options(path, *defaults_files, **kwargs):
    defaults_config = INIConfig()
    defaults_config._new_namespace('client')
    for config in defaults_files:
        _my_config = load_options(config)
        update_config(defaults_config, _my_config)

    for key in ('user', 'password', 'socket', 'host', 'port'):
        if kwargs.get(key) is not None:
            defaults_config['client'][key] = kwargs[key]
    write_options(defaults_config, path)
예제 #2
0
def merge_options(path, *defaults_files, **kwargs):
    defaults_config = INIConfig()
    defaults_config._new_namespace("client")
    for config in defaults_files:
        _my_config = load_options(config)
        update_config(defaults_config, _my_config)

    for key in ("user", "password", "socket", "host", "port"):
        if kwargs.get(key) is not None:
            defaults_config["client"][key] = kwargs[key]
    write_options(defaults_config, path)
예제 #3
0
파일: plugin.py 프로젝트: jschairb/holland
def make_mysql_config(mysql_config):
    """Given a mysql:client config, create a config object
    that represents the auth parameters"""
    defaults_config = INIConfig()
    defaults_config._new_namespace('client')
    for config in mysql_config['defaults-extra-file']:
        LOG.info("Loading %s [%s]", config, os.path.expanduser(config))
        _my_config = load_options(config)
        update_config(defaults_config, _my_config)

    for key in ('user', 'password', 'socket', 'host', 'port'):
        if key in mysql_config and mysql_config[key]:
            defaults_config['client'][key] = mysql_config[key]
    return defaults_config
예제 #4
0
파일: option.py 프로젝트: yodermk/holland
def client_sections(config):
    """Create a copy of config with only valid client auth sections

    This includes [client], [mysql] and [mysqldump] with only options
    related to mysql authentication.
    """

    clean_cfg = INIConfig()
    clean_cfg._new_namespace('client')
    valid_sections = ['client', 'mysql', 'holland']
    for section in valid_sections:
        if section in config:
            clean_section = client_keys(config[section])
            update_config(clean_cfg.client, clean_section)
    return clean_cfg
예제 #5
0
def client_sections(config):
    """Create a copy of config with only valid client auth sections

    This includes [client], [mysql] and [mysqldump] with only options
    related to mysql authentication.
    """

    clean_cfg = INIConfig()
    clean_cfg._new_namespace("client")
    valid_sections = ["client", "mysql", "holland"]
    for section in valid_sections:
        if section in config:
            clean_section = client_keys(config[section])
            update_config(clean_cfg.client, clean_section)
    return clean_cfg