diff options
author | 2017-08-17 11:12:52 +0000 | |
---|---|---|
committer | 2017-08-17 11:12:52 +0000 | |
commit | f01fb5609298c7c4b0f19cfe8d54fc331dd5a0ad (patch) | |
tree | 36b2ffb2b8d56dfabe02b0e85ff30d3822fca51a /functest/cli/commands/cli_env.py | |
parent | c582427bd2586347fd21bcee3b28a2f7e75faf3d (diff) | |
parent | ecaecd74a20e4845fb748077b759a5697ba86f1c (diff) |
Merge "API proposal for functest"
Diffstat (limited to 'functest/cli/commands/cli_env.py')
-rw-r--r-- | functest/cli/commands/cli_env.py | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py index 99d36996..72a870b5 100644 --- a/functest/cli/commands/cli_env.py +++ b/functest/cli/commands/cli_env.py @@ -16,7 +16,7 @@ from functest.utils.constants import CONST import functest.utils.functest_utils as ft_utils -class CliEnv(object): +class Env(object): def __init__(self): pass @@ -56,17 +56,14 @@ class CliEnv(object): if self.status(verbose=False) == 0: STATUS = "ready" - msg = prettytable.PrettyTable( - header_style='upper', padding_width=5, - field_names=['Functest Environment', 'value']) - msg.add_row(['INSTALLER', installer_info]) - msg.add_row(['SCENARIO', scenario]) - msg.add_row(['POD', node]) - if build_tag: - msg.add_row(['BUILD TAG', build_tag]) - msg.add_row(['DEBUG FLAG', is_debug]) - msg.add_row(['STATUS', STATUS]) - click.echo(msg.get_string()) + env_info = {'INSTALLER': installer_info, + 'SCENARIO': scenario, + 'POD': node, + 'DEBUG FLAG': is_debug, + 'BUILD_TAG': build_tag, + 'STATUS': STATUS} + + return env_info def status(self, verbose=True): ret_val = 0 @@ -78,3 +75,19 @@ class CliEnv(object): click.echo("Functest environment ready to run tests.\n") return ret_val + + +class CliEnv(Env): + + def __init__(self): + super(CliEnv, self).__init__() + + def show(self): + env_info = super(CliEnv, self).show() + msg = prettytable.PrettyTable( + header_style='upper', padding_width=5, + field_names=['Functest Environment', 'value']) + for key, value in env_info.iteritems(): + if key is not None: + msg.add_row([key, value]) + click.echo(msg.get_string()) |