def get_token():
keystone_token_request_url = client.concatenate_url(
CONF.gexporter.keystone_endpoint, tokens)
headers = {
"Content-Type": "application/json"
}
auth_data = {
"auth": {
"tenantName": CONF.gexporter.tenant_name,
"passwordCredentials": {
"username": CONF.gexporter.username,
"password": CONF.gexporter.password
}
}
}
resp = client.http_request("POST", keystone_token_request_url, headers,
json.dumps(auth_data), None, None)
json_resp = json.loads(resp.text)
auth_token = json_resp["access"]["token"]["id"]
tenant_id = json_resp["access"]["token"]["tenant"]["id"]
return auth_token, tenant_id
评论列表
文章目录