From 997a42438f2253aa9fe640c1cbdd8ea461901948 Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Sun, 18 Jun 2017 23:43:51 +0200 Subject: Remove all references to /home/opnfv/repos/functest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It also removes relative (and incomplete) references which could be defined in modules instead of this global configuration. Change-Id: Ie20dc3547e49b6224aa8100cd380d37b87ece5a9 Signed-off-by: Cédric Ollivier --- functest/cli/cli_base.py | 6 +++--- functest/cli/commands/cli_env.py | 5 +++-- functest/cli/commands/cli_os.py | 6 +++--- functest/cli/commands/cli_testcase.py | 9 +++++---- functest/cli/commands/cli_tier.py | 9 ++++----- 5 files changed, 18 insertions(+), 17 deletions(-) (limited to 'functest/cli') diff --git a/functest/cli/cli_base.py b/functest/cli/cli_base.py index 2f085834..54b3e72b 100644 --- a/functest/cli/cli_base.py +++ b/functest/cli/cli_base.py @@ -9,12 +9,12 @@ import click import logging.config +import pkg_resources from functest.cli.commands.cli_env import CliEnv from functest.cli.commands.cli_os import CliOpenStack from functest.cli.commands.cli_testcase import CliTestcase from functest.cli.commands.cli_tier import CliTier -from functest.utils.constants import CONST CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) @@ -23,8 +23,8 @@ CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help']) @click.group(context_settings=CONTEXT_SETTINGS) @click.version_option(version='opnfv colorado.0.1 ') def cli(): - logging.config.fileConfig( - CONST.__getattribute__('dir_functest_logging_cfg')) + logging.config.fileConfig(pkg_resources.resource_filename( + 'functest', 'ci/logging.ini')) _env = CliEnv() diff --git a/functest/cli/commands/cli_env.py b/functest/cli/commands/cli_env.py index 8094c84e..ce977572 100644 --- a/functest/cli/commands/cli_env.py +++ b/functest/cli/commands/cli_env.py @@ -8,6 +8,7 @@ # import os +import pkg_resources import click import prettytable @@ -35,8 +36,8 @@ class CliEnv(object): else: answer = raw_input("Invalid answer. Please type [y|n]\n") - cmd = ("python %s/functest/ci/prepare_env.py start" % - CONST.__getattribute__('dir_repo_functest')) + cmd = ("python %s start" % pkg_resources.resource_filename( + 'functest', 'ci/prepare_env.py')) ft_utils.execute_command(cmd) def show(self): diff --git a/functest/cli/commands/cli_os.py b/functest/cli/commands/cli_os.py index c66362fc..875529f2 100644 --- a/functest/cli/commands/cli_os.py +++ b/functest/cli/commands/cli_os.py @@ -9,6 +9,7 @@ import os +import pkg_resources import click @@ -49,9 +50,8 @@ class CliOpenStack(object): def check(self): self.ping_endpoint() - cmd = os.path.join(CONST.__getattribute__('dir_repo_functest'), - "functest/ci/check_os.sh") - ft_utils.execute_command(cmd, verbose=False) + ft_utils.execute_command("sh %s" % pkg_resources.resource_filename( + 'functest', 'ci/check_os.sh'), verbose=False) def snapshot_create(self): self.ping_endpoint() diff --git a/functest/cli/commands/cli_testcase.py b/functest/cli/commands/cli_testcase.py index 3d3f1cb3..91904d87 100644 --- a/functest/cli/commands/cli_testcase.py +++ b/functest/cli/commands/cli_testcase.py @@ -10,6 +10,7 @@ """ global variables """ import os +import pkg_resources import click @@ -25,7 +26,7 @@ class CliTestcase(object): self.tiers = tb.TierBuilder( CONST.__getattribute__('INSTALLER_TYPE'), CONST.__getattribute__('DEPLOY_SCENARIO'), - CONST.__getattribute__('functest_testcases_yaml')) + pkg_resources.resource_filename('functest', 'ci/testcases.yaml')) def list(self): summary = "" @@ -59,8 +60,8 @@ class CliTestcase(object): else: tests = testname.split(",") for test in tests: - cmd = ("python %s/functest/ci/run_tests.py " - "%s -t %s" % - (CONST.__getattribute__('dir_repo_functest'), + cmd = ("python %s %s -t %s" % + (pkg_resources.resource_filename( + 'functest', 'ci/run_tests.py'), flags, test)) ft_utils.execute_command(cmd) diff --git a/functest/cli/commands/cli_tier.py b/functest/cli/commands/cli_tier.py index 531f0ff9..48e9f542 100644 --- a/functest/cli/commands/cli_tier.py +++ b/functest/cli/commands/cli_tier.py @@ -10,6 +10,7 @@ """ global variables """ import os +import pkg_resources import click @@ -24,7 +25,7 @@ class CliTier(object): self.tiers = tb.TierBuilder( CONST.__getattribute__('INSTALLER_TYPE'), CONST.__getattribute__('DEPLOY_SCENARIO'), - CONST.__getattribute__('functest_testcases_yaml')) + pkg_resources.resource_filename('functest', 'ci/testcases.yaml')) def list(self): summary = "" @@ -67,8 +68,6 @@ class CliTier(object): click.echo("Functest environment is not ready. " "Run first 'functest env prepare'") else: - cmd = ("python %s/functest/ci/run_tests.py " - "%s -t %s" % - (CONST.__getattribute__('dir_repo_functest'), - flags, tiername)) + cmd = ("python %s %s -t %s" % (pkg_resources.resource_filename( + 'functest', 'ci/run_tests.py'), flags, tiername)) ft_utils.execute_command(cmd) -- cgit 1.2.3-korg