- CI_INSTALLER_TYPE = os.getenv('INSTALLER_TYPE')
- if CI_INSTALLER_TYPE is None:
- CI_INSTALLER_TYPE = "Unknown"
- CI_INSTALLER_IP = os.getenv('INSTALLER_IP')
- if CI_INSTALLER_IP is None:
- CI_INSTALLER_IP = "Unknown"
- CI_INSTALLER = ("%s, %s" % (CI_INSTALLER_TYPE, CI_INSTALLER_IP))
-
- CI_SCENARIO = os.getenv('DEPLOY_SCENARIO')
- if CI_SCENARIO is None:
- CI_SCENARIO = "Unknown"
-
- CI_NODE = os.getenv('NODE_NAME')
- if CI_NODE is None:
- CI_NODE = "Unknown"
-
- repo = git.Repo(FUNCTEST_REPO)
- branch = repo.head.reference
- GIT_BRANCH = branch.name
- GIT_HASH = branch.commit.hexsha
-
- CI_BUILD_TAG = os.getenv('BUILD_TAG')
- if CI_BUILD_TAG is not None:
- CI_BUILD_TAG = CI_BUILD_TAG.lstrip(
+ def _get_value(attr, default='Unknown'):
+ return attr if attr else default
+
+ install_type = _get_value(CONST.__getattribute__('INSTALLER_TYPE'))
+ installer_ip = _get_value(CONST.__getattribute__('INSTALLER_IP'))
+ installer_info = ("%s, %s" % (install_type, installer_ip))
+ scenario = _get_value(CONST.__getattribute__('DEPLOY_SCENARIO'))
+ node = _get_value(CONST.__getattribute__('NODE_NAME'))
+ repo_h = git.Repo(CONST.__getattribute__('dir_repo_functest')).head
+ if repo_h.is_detached:
+ git_branch = 'detached from FETCH_HEAD'
+ git_hash = repo_h.commit.hexsha
+ else:
+ branch = repo_h.reference
+ git_branch = branch.name
+ git_hash = branch.commit.hexsha
+ is_debug = _get_value(CONST.__getattribute__('CI_DEBUG'), 'false')
+ build_tag = CONST.__getattribute__('BUILD_TAG')
+ if build_tag is not None:
+ build_tag = build_tag.lstrip(