blob: 7e4df2ea56272489b1b02812664f0d7c1d77e820 (
plain)
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
|
import os
import re
default_envs = {
'NODE_NAME': 'unknown_pod',
'CI_DEBUG': 'false',
'DEPLOY_SCENARIO': 'os-nosdn-nofeature-noha',
'DEPLOY_TYPE': 'virt',
'INSTALLER_TYPE': None,
'INSTALLER_IP': None,
'BUILD_TAG': None,
'OS_ENDPOINT_TYPE': None,
'OS_AUTH_URL': None
}
class Environment(object):
def __init__(self):
for k, v in os.environ.iteritems():
self.__setattr__(k, v)
for k, v in default_envs.iteritems():
if k not in os.environ:
self.__setattr__(k, v)
self._set_ci_run()
self._set_ci_loop()
def _set_ci_run(self):
if self.BUILD_TAG:
self.IS_CI_RUN = True
else:
self.IS_CI_RUN = False
def _set_ci_loop(self):
if self.BUILD_TAG and re.search("daily", self.BUILD_TAG):
self.CI_LOOP = "daily"
else:
self.CI_LOOP = "weekly"
ENV = Environment()
|