Fix issue with keystone

Change-Id: Idfeb08fe6946c06b8e6ee933a8ac4b6d62f4406e
Closed-bug: #1310615
This commit is contained in:
Serg Melikyan 2014-04-21 17:13:15 +04:00
parent 727dd58e9b
commit a72df283e2
2 changed files with 13 additions and 6 deletions

View File

@ -47,7 +47,8 @@ class TaskProcessingEndpoint(object):
env.token = task['token']
env.tenant_id = task['tenant_id']
with package_loader.ApiPackageLoader(task['token']) as pkg_loader:
with package_loader.ApiPackageLoader(env.token, env.tenant_id) as \
pkg_loader:
class_loader = package_class_loader.PackageClassLoader(pkg_loader)
system_objects.register(class_loader, pkg_loader)

View File

@ -59,9 +59,9 @@ class PackageLoader(six.with_metaclass(abc.ABCMeta)):
class ApiPackageLoader(PackageLoader):
def __init__(self, token_id):
def __init__(self, token_id, tenant_id):
self._cache_directory = self._get_cache_directory()
self._client = self._get_murano_client(token_id)
self._client = self._get_murano_client(token_id, tenant_id)
def get_package_by_class(self, name):
filter_opts = {'class_name': name, 'limit': 1}
@ -92,7 +92,7 @@ class ApiPackageLoader(PackageLoader):
return directory
@staticmethod
def _get_murano_client(token_id):
def _get_murano_client(token_id, tenant_id):
murano_settings = config.CONF.murano
endpoint_url = murano_settings.url
@ -106,8 +106,14 @@ class ApiPackageLoader(PackageLoader):
insecure=keystone_settings.insecure
)
endpoint_url = keystone_client.url_for(
service_type='murano',
if not keystone_client.authenticate(
auth_url=keystone_settings.auth_url,
tenant_id=tenant_id,
token=token_id):
raise muranoclient_exc.HTTPUnauthorized()
endpoint_url = keystone_client.service_catalog.url_for(
service_type='application_catalog',
endpoint_type=murano_settings.endpoint_type
)