aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
authorCédric Ollivier <cedric.ollivier@orange.com>2018-02-24 11:41:33 +0100
committerCédric Ollivier <cedric.ollivier@orange.com>2018-02-24 15:28:54 +0100
commit67e9875d82d1ee2de3ed64d756092b1f5698c9c0 (patch)
tree994a1c27c8347a975814eeaf4991d1a59e6e6947 /functest/utils
parenta1b0f64bccea682e55ec5086aef979df57cf686f (diff)
Print env vars and env_file
It simply eases detecting wrong inputs [1]. [1] https://build.opnfv.org/ci/view/functest/job/functest-apex-baremetal-daily-master/796/console Change-Id: I0784c29265c69a6ba4a049226196bcdd70b0a572 Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/env.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/functest/utils/env.py b/functest/utils/env.py
index ed09d9f0..5ad870ed 100644
--- a/functest/utils/env.py
+++ b/functest/utils/env.py
@@ -11,6 +11,8 @@
import os
+import prettytable
+
INPUTS = {
'EXTERNAL_NETWORK': None,
'CI_LOOP': 'daily',
@@ -31,3 +33,12 @@ def get(env_var):
if env_var not in INPUTS.keys():
return os.environ.get(env_var, None)
return os.environ.get(env_var, INPUTS[env_var])
+
+
+def string():
+ msg = prettytable.PrettyTable(
+ header_style='upper', padding_width=5,
+ field_names=['env var', 'value'])
+ for env_var in INPUTS:
+ msg.add_row([env_var, get(env_var) if get(env_var) else ''])
+ return msg