diff options
Diffstat (limited to 'dovetail/utils/openstack_utils.py')
-rw-r--r-- | dovetail/utils/openstack_utils.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/dovetail/utils/openstack_utils.py b/dovetail/utils/openstack_utils.py new file mode 100644 index 00000000..c4dfabf9 --- /dev/null +++ b/dovetail/utils/openstack_utils.py @@ -0,0 +1,20 @@ +import json +import os_client_config +import shade +from shade import exc + + +class OS_Utils(object): + + def __init__(self, **kwargs): + self.cloud = shade.OperatorCloud(os_client_config.get_config(**kwargs)) + self.images = [] + self.flavors = [] + + def list_endpoints(self): + try: + res = self.cloud.search_endpoints() + endpoints = json.dumps(res) + return True, endpoints + except exc.OpenStackCloudException as o_exc: + return False, o_exc.orig_message |