diff options
author | RHE <rebirthmonkey@gmail.com> | 2017-12-21 14:46:22 +0100 |
---|---|---|
committer | Thomas Duval <thomas.duval@orange.com> | 2017-12-21 16:43:47 +0100 |
commit | 81fdf943b75f54e885c047503c8ba57dfd6587df (patch) | |
tree | 3577fbde6a34b9139ae2079ccbf842a7f11329d6 /moonv4/tests/utils/config.py | |
parent | 7a35259d6c4a710433a9eb5ee4d29797f1516d4b (diff) |
python_moonclient stable
Change-Id: Ida295ffbe727275916bb80924d275771b592fbb5
Signed-off-by: RHE <rebirthmonkey@gmail.com>
Diffstat (limited to 'moonv4/tests/utils/config.py')
-rw-r--r-- | moonv4/tests/utils/config.py | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/moonv4/tests/utils/config.py b/moonv4/tests/utils/config.py deleted file mode 100644 index d6317820..00000000 --- a/moonv4/tests/utils/config.py +++ /dev/null @@ -1,44 +0,0 @@ -import base64 -import json -import requests - - -def get_configuration(consul_host, consul_port, key): - url = "http://{}:{}/v1/kv/{}".format(consul_host, consul_port, key) - req = requests.get(url) - if req.status_code != 200: - raise Exception("xxx") - data = req.json() - 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 - ] - - -def get_config_data(consul_host, consul_port): - conf_data = dict() - conf_data['manager_host'] = get_configuration(consul_host, consul_port, - 'components/manager')['components/manager']['external']['hostname'] - conf_data['manager_port'] = get_configuration(consul_host, consul_port, - 'components/manager')['components/manager']['external']['port'] - # conf_data['authz_host'] = get_configuration(consul_host, consul_port, - # 'components/interface')['components/interface']['external']['hostname'] - # conf_data['authz_port'] = get_configuration(consul_host, consul_port, - # 'components/interface')['components/interface']['external']['port'] - conf_data['keystone_host'] = get_configuration(consul_host, consul_port, - 'openstack/keystone')['openstack/keystone']['external']['url'] - # conf_data['keystone_port'] = '5000' - conf_data['keystone_user'] = get_configuration(consul_host, consul_port, - 'openstack/keystone')['openstack/keystone']['user'] - conf_data['keystone_password'] = get_configuration(consul_host, consul_port, - 'openstack/keystone')['openstack/keystone']['password'] - conf_data['keystone_project'] = get_configuration(consul_host, consul_port, - 'openstack/keystone')['openstack/keystone']['project'] - return conf_data - -# get_conf_data('88.88.88.2', '30005') -# get_conf_data('127.0.0.1', 8082) |