]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
heat engine : remove unused EC2 style auth from engine
authorSteven Hardy <shardy@redhat.com>
Fri, 19 Oct 2012 15:12:15 +0000 (16:12 +0100)
committerSteven Hardy <shardy@redhat.com>
Fri, 19 Oct 2012 18:16:53 +0000 (19:16 +0100)
We handle EC2 style auth at the heat-api-cfn level, so EC2
style authenticated requests simply pass us an auth_token in
the context, so remove this duplicate/dead code.

Ref #268

Change-Id: I17708cb6ef4b0eb4989d47c116b6211f0d419dcb
Signed-off-by: Steven Hardy <shardy@redhat.com>
heat/engine/auth.py

index b422dbe1cf1d597acf8dd3ec5dee78ee615ab177..cffc566c7fca9b8585a5629dac66443e7964bae1 100644 (file)
@@ -89,41 +89,8 @@ def authenticate(con, service_type='cloudformation', service_name='heat-cfn'):
             'proxy_tenant_id': con.tenant_id,
         }
     else:
-        # We'll have to do AWS style auth which is more complex.
-        # First step is to get a token from the AWS creds.
-        headers = {'Content-Type': 'application/json'}
-
-        o = urlparse.urlparse(con.aws_auth_uri)
-        if o.scheme == 'http':
-            conn = httplib.HTTPConnection(o.netloc)
-        else:
-            conn = httplib.HTTPSConnection(o.netloc)
-        conn.request('POST', o.path, body=con.aws_creds, headers=headers)
-        response = conn.getresponse().read()
-        conn.close()
-
-        result = json.loads(response)
-        try:
-            token_id = result['access']['token']['id']
-            # We grab the username here because with token auth and EC2
-            # we never get it normally.  We could pass it in but then We
-            # are relying on user input to give us the correct username.
-            # This one is the result of the authentication and is verified.
-            username = result['access']['user']['username']
-            con.username = username
-
-            logger.info("AWS authentication successful.")
-        except (AttributeError, KeyError):
-            # FIXME: Should be 404 I think.
-            logger.info("AWS authentication failure.")
-            raise exception.AuthorizationFailure()
-
-        credentials = {
-            'username': con.service_user,
-            'api_key': con.service_password,
-            'proxy_token': token_id,
-            'proxy_tenant_id': con.tenant_id,
-        }
+        logger.error("Authentication failed, no password or auth_token!")
+        return None
 
     args.update(credentials)
     try: