def use_os_admin_auth_token(cluster): if cluster.trust_id: ctx = context.current() ctx.username = CONF.keystone_authtoken.admin_user ctx.tenant_id = cluster.tenant_id client = keystone.client_for_trusts(cluster.trust_id) ctx.token = client.auth_token ctx.service_catalog = json.dumps(client.service_catalog.catalog["catalog"])
def use_os_admin_auth_token(cluster): if cluster.trust_id: ctx = context.current() ctx.username = CONF.os_admin_username ctx.tenant_id = cluster.tenant_id client = keystone.client_for_trusts(cluster.trust_id) ctx.token = client.auth_token ctx.service_catalog = json.dumps( client.service_catalog.catalog['catalog'])
def delete_trust_from_cluster(cluster): '''Delete a trust from a cluster If the cluster has a trust delegated to it, then delete it and set the trust id to None. :param cluster: The cluster to delete the trust from. ''' if cluster.trust_id: keystone_client = keystone.client_for_trusts(cluster.trust_id) delete_trust(keystone_client, cluster.trust_id) ctx = context.current() conductor.cluster_update(ctx, cluster, {'trust_id': None})
def use_os_admin_auth_token(cluster): '''Set the current context to the admin user's trust scoped token This will configure the current context to the admin user's identity with the cluster's tenant. It will also generate an authentication token based on the admin user and a delegated trust associated with the cluster. :param cluster: The cluster to use for tenant and trust identification. ''' if cluster.trust_id: ctx = context.current() ctx.username = CONF.keystone_authtoken.admin_user ctx.tenant_id = cluster.tenant_id client = keystone.client_for_trusts(cluster.trust_id) ctx.token = client.auth_token ctx.service_catalog = json.dumps( client.service_catalog.catalog['catalog'])
def delete_trust(cluster): if cluster.trust_id: keystone_client = keystone.client_for_trusts(cluster.trust_id) keystone_client.trusts.delete(cluster.trust_id)