diff --git a/sahara/service/trusts.py b/sahara/service/trusts.py index cacc43ca..61943736 100644 --- a/sahara/service/trusts.py +++ b/sahara/service/trusts.py @@ -31,7 +31,7 @@ def create_trust(cluster): ctx = context.current() - trustee_id = keystone.client_for_admin(ctx.tenant_id).user_id + trustee_id = keystone.client_for_admin().user_id trust = client.trusts.create(trustor_user=client.user_id, trustee_user=trustee_id, diff --git a/sahara/utils/openstack/keystone.py b/sahara/utils/openstack/keystone.py index e9248e32..bc9cfe50 100644 --- a/sahara/utils/openstack/keystone.py +++ b/sahara/utils/openstack/keystone.py @@ -52,7 +52,7 @@ def client(): return keystone -def _admin_client(tenant_id=None, trust_id=None): +def _admin_client(project_name=None, trust_id=None): if not CONF.use_identity_api_v3: raise Exception('Trusts aren\'t implemented in keystone api' ' less than v3') @@ -60,15 +60,15 @@ def _admin_client(tenant_id=None, trust_id=None): auth_url = base.retrieve_auth_url() keystone = keystone_client_v3.Client(username=CONF.os_admin_username, password=CONF.os_admin_password, - tenant_id=tenant_id, + project_name=project_name, auth_url=auth_url, trust_id=trust_id) keystone.management_url = auth_url return keystone -def client_for_admin(tenant_id): - return _admin_client(tenant_id=tenant_id) +def client_for_admin(): + return _admin_client(project_name=CONF.os_admin_tenant_name) def client_for_trusts(trust_id):