diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-14 16:02:53 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2018-02-16 10:24:22 +0100 |
commit | d589e4e5345ed82c68d9a011ac89f8cdbefe2ca3 (patch) | |
tree | 1ec221f1f95e6abaec9b1465e9e46b76f8777a27 /functest/cli/commands | |
parent | 98e2806cb674d206dea65647c0644dc5b2871b4b (diff) |
Get properly env vars or their default values
It defines env.get() as an unique way to get Functest env vars or
their default values. It can be considered as a wrapper above os.environ.
It enforces backward compatibility via CONST which mustn't be used
for that purpose. It should be noted that it also stops using CONST
for getting OpenStack env vars.
Change-Id: I333dc1afbc0123166a7eaff8b551370098efa341
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/cli/commands')
-rw-r--r-- | functest/cli/commands/cli_env.py | 12 | ||||
-rw-r--r-- | functest/cli/commands/cli_tier.py | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py index f93ef612..18c8895a 100644 --- a/functest/cli/commands/cli_env.py +++ b/functest/cli/commands/cli_env.py @@ -8,21 +8,21 @@ # pylint: disable=missing-docstring -import os - import click import prettytable import six +from functest.utils import env + class Env(object): # pylint: disable=too-few-public-methods @staticmethod def show(): - install_type = os.environ.get('INSTALLER_TYPE', 'Unknown') - scenario = os.environ.get('DEPLOY_SCENARIO', 'Unknown') - node = os.environ.get('NODE_NAME', 'Unknown') - build_tag = os.environ.get('BUILD_TAG', None) + install_type = env.get('INSTALLER_TYPE') + scenario = env.get('DEPLOY_SCENARIO') + node = env.get('NODE_NAME') + build_tag = env.get('BUILD_TAG') if build_tag: build_tag = build_tag.lstrip( "jenkins-").lstrip("functest").lstrip("-") diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py index 933d8cd6..3694c1ae 100644 --- a/functest/cli/commands/cli_tier.py +++ b/functest/cli/commands/cli_tier.py @@ -8,21 +8,21 @@ # pylint: disable=missing-docstring -import os import pkg_resources import click from functest.ci import tier_builder from functest.utils import functest_utils +from functest.utils import env class Tier(object): def __init__(self): self.tiers = tier_builder.TierBuilder( - os.environ['INSTALLER_TYPE'], - os.environ['DEPLOY_SCENARIO'], + env.get('INSTALLER_TYPE'), + env.get('DEPLOY_SCENARIO'), pkg_resources.resource_filename('functest', 'ci/testcases.yaml')) def list(self): |