You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by vd...@apache.org on 2018/09/19 08:09:40 UTC

[04/18] libcloud git commit: Fix LIBCLOUD-965

Fix LIBCLOUD-965


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e23be018
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e23be018
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e23be018

Branch: refs/heads/trunk
Commit: e23be01804d4d435382fb2dc2b1bf68ad0f5e401
Parents: 00efcf2
Author: micafer <mi...@upv.es>
Authored: Thu Nov 30 09:56:02 2017 +0100
Committer: micafer <mi...@upv.es>
Committed: Thu Nov 30 09:56:02 2017 +0100

----------------------------------------------------------------------
 libcloud/common/openstack_identity.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e23be018/libcloud/common/openstack_identity.py
----------------------------------------------------------------------
diff --git a/libcloud/common/openstack_identity.py b/libcloud/common/openstack_identity.py
index 966c12b..4285933 100644
--- a/libcloud/common/openstack_identity.py
+++ b/libcloud/common/openstack_identity.py
@@ -1525,12 +1525,23 @@ class OpenStackIdentity_3_0_Connection_OIDC_access_token(
         """
         Get the first project ID accessible with the specified access token
         """
-        path = '/v3/OS-FEDERATION/projects'
+        # Try new path first (from ver 1.1)
+        path = '/v3/auth/projects'
         response = self.request(path,
                                 headers={'Content-Type': 'application/json',
                                          'X-Auth-Token': token},
                                 method='GET')
 
+        if response.status not in [httplib.UNAUTHORIZED, httplib.OK,
+                                   httplib.CREATED]:
+            # In case of error try old one
+            path = '/v3/OS-FEDERATION/projects'
+            response = self.request(path,
+                                    headers={'Content-Type':
+                                             'application/json',
+                                             'X-Auth-Token': token},
+                                    method='GET')
+
         if response.status == httplib.UNAUTHORIZED:
             # Invalid credentials
             raise InvalidCredsError()