summaryrefslogtreecommitdiffstats
path: root/dovetail/utils/openstack_utils.py
diff options
context:
space:
mode:
authorxudan <xudan16@huawei.com>2018-09-04 00:18:58 -0400
committerGeorg Kunz <georg.kunz@ericsson.com>2018-09-10 16:24:21 +0000
commita5696da7e4c1bc36e8ec97bf0db8ef8d5c555e2e (patch)
tree2a674f175e7e6d131581e712878a247b6adb3eea /dovetail/utils/openstack_utils.py
parent15e67ead211b39f2c9793e89a0058ba6bd75cb87 (diff)
Enable the web portal to show all endpoints
The endpoints info for the 2018.08 has been changed. The web portal needs some adaptions for the new data format. It keeps the same as 2018.01 and doesn't need to change dovetail-webportal. JIRA: DOVETAIL-725 Change-Id: I74cde3aa6032c7afac4b6ce1d2146e09a0f99fe5 Signed-off-by: xudan <xudan16@huawei.com> (cherry picked from commit 3f92680059a8371ec6002e1d909cd89cc4bab96d)
Diffstat (limited to 'dovetail/utils/openstack_utils.py')
-rw-r--r--dovetail/utils/openstack_utils.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/dovetail/utils/openstack_utils.py b/dovetail/utils/openstack_utils.py
index 2c57b7c8..2ce2df9d 100644
--- a/dovetail/utils/openstack_utils.py
+++ b/dovetail/utils/openstack_utils.py
@@ -8,7 +8,6 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
-import json
import os_client_config
import shade
from shade import exc
@@ -21,10 +20,16 @@ class OS_Utils(object):
self.images = []
self.flavors = []
- def list_endpoints(self):
+ def search_endpoints(self, interface='public'):
try:
- res = self.cloud.search_endpoints()
- endpoints = json.dumps(res)
- return True, endpoints
+ res = self.cloud.search_endpoints(filters={'interface': interface})
+ return True, res
+ except exc.OpenStackCloudException as o_exc:
+ return False, o_exc.orig_message
+
+ def search_services(self, service_id=None):
+ try:
+ res = self.cloud.search_services(name_or_id=service_id)
+ return True, res
except exc.OpenStackCloudException as o_exc:
return False, o_exc.orig_message