summaryrefslogtreecommitdiff
path: root/keystoneclient/generic
diff options
context:
space:
mode:
authorJose Castro Leon <jose.castro.leon@cern.ch>2014-01-17 15:04:18 +0100
committerJose Castro Leon <jose.castro.leon@cern.ch>2014-01-27 09:31:29 +0100
commit649b9b9431c00f3d00411ea59cddb9e81ae34bcf (patch)
treeada064e853039c6b46d9039de2e35261ea0ec92b /keystoneclient/generic
parent454f237bc3249d4eb4e5fe3d9e08b7abe3c76574 (diff)
downloadpython-keystoneclient-649b9b9431c00f3d00411ea59cddb9e81ae34bcf.tar.gz
Fix discover command failed to discover keystone in ssl
Fix the blocking behavior of keystone discover when trying to obtain information of the local keystone. It does not block while checking and checks both protocols HTTP and HTTPS Change-Id: I43616a348bf04163bf7967a12957556d7edfde40 Closes-Bug: #1270154
Diffstat (limited to 'keystoneclient/generic')
-rw-r--r--keystoneclient/generic/client.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/keystoneclient/generic/client.py b/keystoneclient/generic/client.py
index 79cbbc5..58bc52d 100644
--- a/keystoneclient/generic/client.py
+++ b/keystoneclient/generic/client.py
@@ -75,15 +75,17 @@ class Client(httpclient.HTTPClient):
def _local_keystone_exists(self):
"""Checks if Keystone is available on default local port 35357."""
- return self._check_keystone_versions("http://localhost:35357")
+ results = self._check_keystone_versions("http://localhost:35357")
+ if results is None:
+ results = self._check_keystone_versions("https://localhost:35357")
+ return results
def _check_keystone_versions(self, url):
"""Calls Keystone URL and detects the available API versions."""
try:
- client = httpclient.HTTPClient()
- resp, body = client.request(url, "GET",
- headers={'Accept':
- 'application/json'})
+ resp, body = self.request(url, "GET",
+ headers={'Accept':
+ 'application/json'})
# Multiple Choices status code is returned by the root
# identity endpoint, with references to one or more
# Identity API versions -- v3 spec
@@ -143,12 +145,11 @@ class Client(httpclient.HTTPClient):
def _check_keystone_extensions(self, url):
"""Calls Keystone URL and detects the available extensions."""
try:
- client = httpclient.HTTPClient()
if not url.endswith("/"):
url += '/'
- resp, body = client.request("%sextensions" % url, "GET",
- headers={'Accept':
- 'application/json'})
+ resp, body = self.request("%sextensions" % url, "GET",
+ headers={'Accept':
+ 'application/json'})
if resp.status_code in (200, 204): # some cases we get No Content
try:
results = {}