def get_query_server_config(server=None): if not server or server not in DATABASES: keys = DATABASES.keys() name = keys and keys[0] or None else: name = server if name: query_server = { 'server_name': DATABASES[name].ENGINE.get().split('.')[-1], 'server_host': DATABASES[name].HOST.get(), 'server_port': DATABASES[name].PORT.get(), 'username': DATABASES[name].USER.get(), 'password': get_database_password(name), 'options': force_dict_to_strings(DATABASES[name].OPTIONS.get()), 'alias': name } if DATABASES[name].NAME.get(): query_server['name'] = DATABASES[name].NAME.get() else: query_server = {} LOG.debug("Query Server: %s" % query_server) return query_server
def get_query_server_config(server=None): if not server or server not in DATABASES: keys = DATABASES.keys() name = keys and keys[0] or None else: name = server if name: query_server = { 'server_name': DATABASES[name].ENGINE.get().split('.')[-1], 'server_host': DATABASES[name].HOST.get(), 'server_port': DATABASES[name].PORT.get(), 'username': DATABASES[name].USER.get(), 'password': DATABASES[name].PASSWORD.get(), 'options': force_dict_to_strings(DATABASES[name].OPTIONS.get()), 'alias': name } if DATABASES[name].NAME.get(): query_server['name'] = DATABASES[name].NAME.get() else: query_server = {} LOG.debug("Query Server: %s" % query_server) return query_server
def get_query_server_config(server=None): if not server or server not in DATABASES: keys = DATABASES.keys() name = keys and keys[0] or None else: name = server if name: query_server = { "server_name": DATABASES[name].ENGINE.get().split(".")[-1], "server_host": DATABASES[name].HOST.get(), "server_port": DATABASES[name].PORT.get(), "username": DATABASES[name].USER.get(), "password": get_database_password(name), "options": force_dict_to_strings(DATABASES[name].OPTIONS.get()), "alias": name, } if DATABASES[name].NAME.get(): query_server["name"] = DATABASES[name].NAME.get() else: query_server = {} LOG.debug("Query Server: %s" % query_server) return query_server