aboutsummaryrefslogtreecommitdiffstats
path: root/python_moonclient
diff options
context:
space:
mode:
authorRuan HE <ruan.he@orange.com>2017-12-27 12:55:12 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-12-27 12:55:12 +0000
commit1ae589007f72d648f03745983633b5453cae0592 (patch)
tree9949f60696db589b9ef1ac480cd2eb196d9d5299 /python_moonclient
parenta7d5b9a4b29e3b3d18b3a63bd32b28c1008ec48e (diff)
parent30dfb6af2e2cd2cbc1632031202f48c1ef6a876f (diff)
Merge "moon_forming for policy templates"
Diffstat (limited to 'python_moonclient')
-rw-r--r--python_moonclient/Changelog10
-rw-r--r--python_moonclient/python_moonclient/__init__.py2
-rw-r--r--python_moonclient/python_moonclient/config.py44
3 files changed, 40 insertions, 16 deletions
diff --git a/python_moonclient/Changelog b/python_moonclient/Changelog
index 854200cb..cd099ae3 100644
--- a/python_moonclient/Changelog
+++ b/python_moonclient/Changelog
@@ -9,4 +9,12 @@ CHANGES
0.1.0
-----
-- First version of the python-moonclient \ No newline at end of file
+- First version of the python-moonclient
+
+1.0.0
+-----
+- First public version of the python-moonclient
+
+1.0.1
+-----
+- Fix a bug in configuration
diff --git a/python_moonclient/python_moonclient/__init__.py b/python_moonclient/python_moonclient/__init__.py
index d7cdd111..2249a1b6 100644
--- a/python_moonclient/python_moonclient/__init__.py
+++ b/python_moonclient/python_moonclient/__init__.py
@@ -3,4 +3,4 @@
# license which can be found in the file 'LICENSE' in this package distribution
# or at 'http://www.apache.org/licenses/LICENSE-2.0'.
-__version__ = "0.0.1"
+__version__ = "1.0.1"
diff --git a/python_moonclient/python_moonclient/config.py b/python_moonclient/python_moonclient/config.py
index d6317820..300ebf1a 100644
--- a/python_moonclient/python_moonclient/config.py
+++ b/python_moonclient/python_moonclient/config.py
@@ -21,17 +21,36 @@ def get_configuration(consul_host, consul_port, key):
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['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']
+ try:
+ requests.get("http://{}:{}/".format(
+ conf_data['manager_host'],
+ conf_data['manager_port']
+ ),
+ timeout=2)
+ except requests.exceptions.ConnectionError:
+ conf_data['manager_host'] = get_configuration(consul_host, consul_port,
+ 'components/manager')[
+ 'components/manager']['hostname']
+ conf_data['manager_port'] = get_configuration(consul_host, consul_port,
+ 'components/manager')[
+ 'components/manager']['port']
+
+ conf_data['keystone_host'] = get_configuration(
+ consul_host, consul_port,
+ 'openstack/keystone')['openstack/keystone']['external']['url']
+ try:
+ requests.get(conf_data['keystone_host'], timeout=2)
+ except requests.exceptions.ConnectionError:
+ conf_data['keystone_host'] = get_configuration(
+ consul_host, consul_port,
+ 'openstack/keystone')['openstack/keystone']['url']
+
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,
@@ -39,6 +58,3 @@ def get_config_data(consul_host, consul_port):
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)