-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcredentials.py
More file actions
46 lines (36 loc) · 1.08 KB
/
Copy pathcredentials.py
File metadata and controls
46 lines (36 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
"""
Description: This script is to map the environment variables to credentials \
dict based on the client service API
Developer: gopal@onecloudinc.com
"""
from config import OS_USERNAME, OS_TENANT_NAME, OS_PASSWORD, OS_AUTH_URL
def get_credentials():
"""
This method is used for authorization with keystone clients
"""
data = {}
data['username'] = OS_USERNAME
data['password'] = OS_PASSWORD
data['auth_url'] = OS_AUTH_URL
data['tenant_name'] = OS_TENANT_NAME
return data
def get_nova_credentials():
"""
This method is used for authorization with nova clients
"""
data = {}
data['username'] = OS_USERNAME
data['api_key'] = OS_PASSWORD
data['auth_url'] = OS_AUTH_URL
data['project_id'] = OS_TENANT_NAME
return data
def get_tenant_nova_credentials(tenant_name):
"""
This method is used for tenant authorization with nova clients
"""
data = {}
data['username'] = OS_USERNAME
data['api_key'] = OS_PASSWORD
data['auth_url'] = OS_AUTH_URL
data['project_id'] = tenant_name
return data