-
Notifications
You must be signed in to change notification settings - Fork 2
/
credentials.py
79 lines (66 loc) · 2.11 KB
/
credentials.py
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 2016 Universitatea Stefan cel Mare Suceava
# Copyright 2016 NUBOMEDIA
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from images_configurations import *
def get_keystone_creds():
d = {}
env = os.environ.get('OS_USERNAME')
if env is None:
d['username'] = username
d['password'] = password
d['auth_url'] = auth_url
d['tenant_name'] = tenant_name
else:
d['username'] = os.environ['OS_USERNAME']
d['password'] = os.environ['OS_PASSWORD']
d['auth_url'] = os.environ['OS_AUTH_URL']
d['tenant_name'] = os.environ['OS_TENANT_NAME']
return d
def get_nova_creds():
d = {}
env = os.environ.get('OS_USERNAME')
if env is None:
d['username'] = username
d['api_key'] = password
d['auth_url'] = auth_url
d['project_id'] = tenant_name
else:
d['username'] = os.environ['OS_USERNAME']
d['api_key'] = os.environ['OS_PASSWORD']
d['auth_url'] = os.environ['OS_AUTH_URL']
d['project_id'] = os.environ['OS_TENANT_NAME']
return d
def get_glance_creds():
env = os.environ.get('GLANCE_ENDPOINT')
if env is None:
d = glance_endpoint
else:
d = os.environ['GLANCE_ENDPOINT']
return d
def get_master_creds():
d = {}
d['username'] = master_user
if master_pass is None:
d['key_filename'] = master_key
else:
d['password'] = master_pass
return d
def get_master_ip():
return master_ip
def get_env_vars():
d = {}
d['floating_ip_pool'] = floating_ip_pool
return d