summaryrefslogtreecommitdiffstats
path: root/functest/cli
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-12 11:33:49 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-13 07:41:27 +0100
commit9e9e8c9b89fc7c419d1824190217897118800275 (patch)
tree246e617ac78afbd09aa8bf928556291bf2f0a6b3 /functest/cli
parentb1522c34d95f9bb48fc9cfca91f281da2f958953 (diff)
Simplify functest/cli/commands/cli_env.py
CONST shouldn't be used for getting/setting env vars. It adds complexity and may raise side effects. It also removes the obsolete env var CI_DEBUG. Change-Id: I8a8fde0fa781351d5eabd2698ca8aae9dee76fb8 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/cli')
-rw-r--r--functest/cli/commands/cli_env.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py
index c1b66da4..a5c0e399 100644
--- a/functest/cli/commands/cli_env.py
+++ b/functest/cli/commands/cli_env.py
@@ -8,11 +8,10 @@
# pylint: disable=missing-docstring
+import os
+
import click
import prettytable
-
-from functest.utils.constants import CONST
-
import six
@@ -20,24 +19,19 @@ class Env(object): # pylint: disable=too-few-public-methods
@staticmethod
def show():
- 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'))
+ install_type = os.environ.get('INSTALLER_TYPE', 'Unknown')
+ installer_ip = os.environ.get('INSTALLER_IP', 'Unknown')
installer_info = ("%s, %s" % (install_type, installer_ip))
- scenario = _get_value(CONST.__getattribute__('DEPLOY_SCENARIO'))
- node = _get_value(CONST.__getattribute__('NODE_NAME'))
- is_debug = _get_value(CONST.__getattribute__('CI_DEBUG'), 'false')
- build_tag = CONST.__getattribute__('BUILD_TAG')
- if build_tag is not None:
+ scenario = os.environ.get('DEPLOY_SCENARIO', 'Unknown')
+ node = os.environ.get('NODE_NAME', 'Unknown')
+ build_tag = os.environ.get('BUILD_TAG', None)
+ if build_tag:
build_tag = build_tag.lstrip(
"jenkins-").lstrip("functest").lstrip("-")
env_info = {'INSTALLER': installer_info,
'SCENARIO': scenario,
'POD': node,
- 'DEBUG FLAG': is_debug,
'BUILD_TAG': build_tag}
return env_info