def get_swift_conf(cfg, section): user_name = cfg.get(section, 'user_name') password = cfg.get(section, 'password') container = cfg.get(section, 'container') auth_host = cfg.get(section, 'auth_host') if not cfg.has_option(section, 'auth_ver'): auth_ver = 'v2.0' else: auth_ver = cfg.get(section, 'auth_ver') if auth_ver != 'v1.0': tenant = cfg.get(section, 'tenant') else: tenant = None if cfg.has_option(section, 'use_https'): use_https = cfg.getboolean(section, 'use_https') else: use_https = False if cfg.has_option(section, 'region'): region = cfg.get(section, 'region') else: region = None if cfg.has_option(section, 'domain'): domain = cfg.get(section, 'domain') else: domain = 'default' from seafobj.backends.swift import SwiftConf conf = SwiftConf(user_name, password, container, auth_host, auth_ver, tenant, use_https, region, domain) return conf
def get_swift_conf_from_json (cfg): user_name = cfg['user_name'] password = cfg['password'] container = cfg['container'] auth_host = cfg['auth_host'] if not cfg.has_key('auth_ver'): auth_ver = 'v2.0' else: auth_ver = cfg['auth_ver'] if auth_ver != 'v1.0': tenant = cfg['tenant'] else: tenant = None if cfg.has_key('use_https') and cfg['use_https']: use_https = True else: use_https = False if cfg.has_key('region'): region = cfg['region'] else: region = None if cfg.has_key('domain'): domain = cfg['domain'] else: domain = 'default' from seafobj.backends.swift import SwiftConf conf = SwiftConf(user_name, password, container, auth_host, auth_ver, tenant, use_https, region, domain) return conf
def get_swift_conf(cfg, section): user_name = cfg.get(section, 'user_name') password = cfg.get(section, 'password') container = cfg.get(section, 'container') auth_host = cfg.get(section, 'auth_host') if not cfg.has_option(section, 'auth_ver'): auth_ver = 'v2.0' else: auth_ver = cfg.get(section, 'auth_ver') tenant = cfg.get(section, 'tenant') if cfg.has_option(section, 'use_https'): use_https = cfg.getboolean(section, 'use_https') else: use_https = False from seafobj.backends.swift import SwiftConf conf = SwiftConf(user_name, password, container, auth_host, auth_ver, tenant, use_https) return conf