]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Use password in preference to token if both supplied
authorZane Bitter <zbitter@redhat.com>
Tue, 16 Oct 2012 14:33:55 +0000 (16:33 +0200)
committerZane Bitter <zbitter@redhat.com>
Wed, 17 Oct 2012 08:21:10 +0000 (10:21 +0200)
Fixes #263 - devstack is providing a token in the environment, which was
causing the wrong path to get hit.

Change-Id: I9aae346e57fdfe156e52d4696e8f2f859884ff2f
Signed-off-by: Zane Bitter <zbitter@redhat.com>
heat/engine/auth.py

index 067e323b35fcfb2a4101f66c39329d3860b18229..616ed18f3fd537bcf1e22d9c13ca78015dcec2d0 100644 (file)
@@ -76,18 +76,18 @@ def authenticate(con, service_type='cloudformation', service_name='heat'):
         'service_name': service_name,
     }
 
-    if con.auth_token is not None:
+    if con.password is not None:
+        credentials = {
+            'username': con.username,
+            'api_key': con.password,
+        }
+    elif con.auth_token is not None:
         credentials = {
             'username': con.service_user,
             'api_key': con.service_password,
             'proxy_token': con.auth_token,
             'proxy_tenant_id': con.tenant_id,
         }
-    elif con.password is not None:
-        credentials = {
-            'username': con.username,
-            'api_key': con.password,
-        }
     else:
         # We'll have to do AWS style auth which is more complex.
         # First step is to get a token from the AWS creds.