def get_swift_configs(): configs = x.load_hadoop_xml_defaults('swift/resources/conf-template.xml') for conf in configs: if conf['name'] == HADOOP_SWIFT_AUTH_URL: conf['value'] = base.retrieve_auth_url() + "tokens/" if conf['name'] == HADOOP_SWIFT_TENANT: conf['value'] = _retrieve_tenant() result = [cfg for cfg in configs if cfg['value']] LOG.info("Swift would be integrated with the following " "params: %s", result) return result
def client_for_trusts(username, password, trust_id): if not CONF.use_identity_api_v3: raise Exception('Trusts aren\'t implemented in keystone api' ' less than v3') ctx = context.current() auth_url = base.retrieve_auth_url() keystone = keystone_client_v3.Client(username=username, password=password, tenant_id=ctx.tenant_id, auth_url=auth_url, trust_id=trust_id) keystone.management_url = auth_url return keystone
def client(): ctx = context.current() auth_url = base.retrieve_auth_url() if CONF.use_identity_api_v3: keystone = keystone_client_v3.Client(username=ctx.username, token=ctx.token, tenant_id=ctx.tenant_id, auth_url=auth_url) keystone.management_url = auth_url else: keystone = keystone_client.Client(username=ctx.username, token=ctx.token, tenant_id=ctx.tenant_id, auth_url=auth_url) return keystone
def client(): ctx = context.current() auth_url = base.retrieve_auth_url() compute_url = base.url_for(ctx.service_catalog, 'compute') nova = nova_client.Client(username=ctx.username, api_key=None, project_id=ctx.tenant_id, auth_url=auth_url) nova.client.auth_token = ctx.token nova.client.management_url = compute_url nova.images = images.SavannaImageManager(nova) # unconditionally patch 'get' until # https://bugs.launchpad.net/python-novaclient/+bug/1223934 # is fixed for our use case and all we support nova.keypairs = keypairs.SavannaKeypairManager(nova) return nova
def _get_conn(user, password): return swiftclient.Connection(base.retrieve_auth_url(), user, password, tenant_name=CONF.os_admin_tenant_name, auth_version="2.0")