From: Steven Hardy Date: Mon, 8 Oct 2012 15:21:25 +0000 (+0100) Subject: heat engine : workaround lack of no_cache on essex X-Git-Tag: 2014.1~1341 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=49ce173820ec8bd1928252a8eacb85d4373711dc;p=openstack-build%2Fheat-build.git heat engine : workaround lack of no_cache on essex no_cache novaclient fix doesn't work on essex, so try both the essex and the folsom compatible novaclient prototypes Change-Id: I0749f821981550d7a5f5a95e2f5951c77d8e1529 Signed-off-by: Steven Hardy --- diff --git a/heat/engine/auth.py b/heat/engine/auth.py index 153b2437..980ea042 100644 --- a/heat/engine/auth.py +++ b/heat/engine/auth.py @@ -70,13 +70,26 @@ def authenticate(con, service_type='orchestration', service_name='heat'): """ if con.password is not None: - nova = client.Client(username=con.username, - api_key=con.password, - project_id=con.tenant, - auth_url=con.auth_url, - service_type=service_type, - service_name=service_name, - no_cache=True) + try: + # Workaround for issues with python-keyring, need no_cache=True + # ref https://bugs.launchpad.net/python-novaclient/+bug/1020238 + # TODO(shardy): May be able to remove when the bug above is fixed + nova = client.Client(username=con.username, + api_key=con.password, + project_id=con.tenant, + auth_url=con.auth_url, + service_type=service_type, + service_name=service_name, + no_cache=True) + except TypeError: + # for compatibility with essex, which doesn't have no_cache=True + # TODO(shardy): remove when we no longer support essex + nova = client.Client(username=con.username, + api_key=con.password, + project_id=con.tenant, + auth_url=con.auth_url, + service_type=service_type, + service_name=service_name) nova.authenticate() return nova else: @@ -109,12 +122,25 @@ def authenticate(con, service_type='orchestration', service_name='heat'): logger.info("AWS authentication failure.") raise exception.AuthorizationFailure() - nova = client.Client(con.service_user, con.service_password, - con.tenant, con.auth_url, - proxy_token=token_id, - proxy_tenant_id=con.tenant_id, - service_type=service_type, - service_name=service_name, - no_cache=True) + try: + # Workaround for issues with python-keyring, need no_cache=True + # ref https://bugs.launchpad.net/python-novaclient/+bug/1020238 + # TODO(shardy): May be able to remove when the bug above is fixed + nova = client.Client(con.service_user, con.service_password, + con.tenant, con.auth_url, + proxy_token=token_id, + proxy_tenant_id=con.tenant_id, + service_type=service_type, + service_name=service_name, + no_cache=True) + except TypeError: + # for compatibility with essex, which doesn't have no_cache=True + # TODO(shardy): remove when we no longer support essex + nova = client.Client(con.service_user, con.service_password, + con.tenant, con.auth_url, + proxy_token=token_id, + proxy_tenant_id=con.tenant_id, + service_type=service_type, + service_name=service_name) nova.authenticate() return nova