remove imported FUNCTEST_REPO object
[functest.git] / cli / commands / cli_os.py
index b007842..fc027d5 100644 (file)
@@ -9,18 +9,15 @@
 
 
 import os
+
 import click
+
 import functest.utils.functest_utils as ft_utils
 import functest.utils.openstack_clean as os_clean
 import functest.utils.openstack_snapshot as os_snapshot
-import yaml
-
 
-with open(os.environ["CONFIG_FUNCTEST_YAML"]) as f:
-    functest_yaml = yaml.safe_load(f)
+functest_yaml = ft_utils.get_functest_yaml()
 
-REPOS_DIR = os.getenv('repos_dir')
-FUNCTEST_REPO = ("%s/functest/" % REPOS_DIR)
 FUNCTEST_CONF_DIR = functest_yaml.get("general").get(
     "directories").get("dir_functest_conf")
 RC_FILE = os.getenv('creds')
@@ -83,7 +80,7 @@ class CliOpenStack:
 
     def check(self):
         self.ping_endpoint()
-        cmd = FUNCTEST_REPO + "ci/check_os.sh"
+        cmd = ft_utils.FUNCTEST_REPO + "/ci/check_os.sh"
         ft_utils.execute_command(cmd, verbose=False)
 
     def snapshot_create(self):
@@ -106,7 +103,8 @@ class CliOpenStack:
     def snapshot_show(self):
         if not os.path.isfile(OS_SNAPSHOT_FILE):
             click.echo("There is no OpenStack snapshot created. To create "
-                       "one run the command 'functest env os-create-snapshot'")
+                       "one run the command "
+                       "'functest openstack snapshot-create'")
             return
         with open(OS_SNAPSHOT_FILE, 'r') as yaml_file:
             click.echo("\n%s"
@@ -117,6 +115,7 @@ class CliOpenStack:
         if not os.path.isfile(OS_SNAPSHOT_FILE):
             click.echo("Not possible to clean OpenStack without a snapshot. "
                        "This could cause problems. "
-                       "Run first the command 'os-create-shapshot'.")
+                       "Run first the command "
+                       "'functest openstack snapshot-create'")
             return
         os_clean.main()