diff options
| author | Jenkins <jenkins@review.openstack.org> | 2016-01-14 00:45:04 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2016-01-14 00:45:04 +0000 |
| commit | fa3077d51a77b4244c2b9655e28c06d208c80114 (patch) | |
| tree | 5dfdb1940b8c949d7ad466e2d0c6f0d00f3e674c /openstackclient/common | |
| parent | bd1adaf003a805a1b480b7b48db2a9fe6c4a5ee9 (diff) | |
| parent | 57dac0bc3add71d6c491e2cecc60ef756b75ac32 (diff) | |
| download | python-openstackclient-fa3077d51a77b4244c2b9655e28c06d208c80114.tar.gz | |
Merge "Refactor network endpoint enablement checking"
Diffstat (limited to 'openstackclient/common')
| -rw-r--r-- | openstackclient/common/clientmanager.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index edabf65e..dce19725 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -191,6 +191,26 @@ class ClientManager(object): self._auth_ref = self.auth.get_auth_ref(self.session) return self._auth_ref + def is_network_endpoint_enabled(self): + """Check if the network endpoint is enabled""" + # Trigger authentication necessary to determine if the network + # endpoint is enabled. + if self.auth_ref: + service_catalog = self.auth_ref.service_catalog + else: + service_catalog = None + # Assume that the network endpoint is enabled. + network_endpoint_enabled = True + if service_catalog: + if 'network' in service_catalog.get_endpoints(): + LOG.debug("Network endpoint in service catalog") + else: + LOG.debug("No network endpoint in service catalog") + network_endpoint_enabled = False + else: + LOG.debug("No service catalog, assuming network endpoint enabled") + return network_endpoint_enabled + def get_endpoint_for_service_type(self, service_type, region_name=None, interface='public'): """Return the endpoint URL for the service type.""" |
