aboutsummaryrefslogtreecommitdiffstats
path: root/python_moonclient
diff options
context:
space:
mode:
authorRHE <rebirthmonkey@gmail.com>2017-12-27 09:58:36 +0100
committerThomas Duval <thomas.duval@orange.com>2017-12-27 13:53:35 +0100
commit30dfb6af2e2cd2cbc1632031202f48c1ef6a876f (patch)
tree41d5dea2f0caace22b34b4c87fb1995eaf5c14b1 /python_moonclient
parent6ca8af03c997444eaeda788b1e5a341a4cd8e8e5 (diff)
moon_forming for policy templates
Change-Id: I8f19a9c4d791d509a6c0349424252ea24c56ab6b Signed-off-by: RHE <rebirthmonkey@gmail.com>
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)