diff options
author | Asteroide <thomas.duval@orange.com> | 2018-10-05 15:01:17 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2018-10-05 15:01:17 +0000 |
commit | cbea4e360e9bfaa9698cf7c61c83c96a1ba89b8c (patch) | |
tree | a8bf6a7bfb06605ed5bfab77570afbe1e46cff4b /python_moonclient/python_moonclient/core/config.py | |
parent | a3f68df52836676b23ac0f5e3d8c40c957ee80a7 (diff) | |
parent | 2e35a7e46f0929438c1c206e3116caa829f07dc6 (diff) |
Merge "Update code to 4.6 official version"
Diffstat (limited to 'python_moonclient/python_moonclient/core/config.py')
-rw-r--r-- | python_moonclient/python_moonclient/core/config.py | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/python_moonclient/python_moonclient/core/config.py b/python_moonclient/python_moonclient/core/config.py index f8e3fe29..c123499b 100644 --- a/python_moonclient/python_moonclient/core/config.py +++ b/python_moonclient/python_moonclient/core/config.py @@ -14,11 +14,10 @@ def get_configuration(consul_host, consul_port, key): if len(data) == 1: data = data[0] return {data["Key"]: json.loads(base64.b64decode(data["Value"]).decode("utf-8"))} - else: - return [ - {item["Key"]: json.loads(base64.b64decode(item["Value"]).decode("utf-8"))} - for item in data - ] + return [ + {item["Key"]: json.loads(base64.b64decode(item["Value"]).decode("utf-8"))} + for item in data + ] def get_config_data(consul_host, consul_port): @@ -31,9 +30,9 @@ def get_config_data(consul_host, consul_port): 'components/manager')['components/manager']['external']['port'] try: requests.get("http://{}:{}/".format( - conf_data['manager_host'], - conf_data['manager_port'] - ), + conf_data['manager_host'], + conf_data['manager_port'] + ), timeout=2) except requests.exceptions.ConnectionError: conf_data['manager_host'] = get_configuration(consul_host, consul_port, @@ -54,9 +53,12 @@ def get_config_data(consul_host, consul_port): 'openstack/keystone')['openstack/keystone']['url'] conf_data['keystone_user'] = get_configuration(consul_host, consul_port, - 'openstack/keystone')['openstack/keystone']['user'] + 'openstack/keystone')['openstack/keystone'][ + 'user'] conf_data['keystone_password'] = get_configuration(consul_host, consul_port, - 'openstack/keystone')['openstack/keystone']['password'] + 'openstack/keystone')['openstack/keystone'][ + 'password'] conf_data['keystone_project'] = get_configuration(consul_host, consul_port, - 'openstack/keystone')['openstack/keystone']['project'] + 'openstack/keystone')['openstack/keystone'][ + 'project'] return conf_data |