Merge "Fix the yamllint errors in functest/ci"
[functest.git] / functest / cli / cli_base.py
index 3b14fa3..aa8ab24 100644 (file)
@@ -8,19 +8,24 @@
 #
 
 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
 
+
 CONTEXT_SETTINGS = dict(help_option_names=['-h', '--help'])
 
 
 @click.group(context_settings=CONTEXT_SETTINGS)
 @click.version_option(version='opnfv colorado.0.1 ')
 def cli():
-    pass
+    logging.config.fileConfig(pkg_resources.resource_filename(
+        'functest', 'ci/logging.ini'))
+    logging.captureWarnings(True)
 
 
 _env = CliEnv()
@@ -82,29 +87,11 @@ def os_show_credentials():
     _openstack.show_credentials()
 
 
-@openstack.command('fetch-rc', help="Fetch the OpenStack RC file from "
-                   "the installer.")
-def os_fetch_rc():
-    _openstack.fetch_credentials()
-
-
-@env.command('prepare', help="Prepares the Functest environment. This step is "
-             "needed run the tests.")
-def env_prepare():
-    _env.prepare()
-
-
 @env.command('show', help="Shows information about the current environment.")
 def env_show():
     _env.show()
 
 
-@env.command('status', help="Checks if the Functest environment is ready to "
-             "run the tests.")
-def env_status():
-    _env.status()
-
-
 @testcase.command('list', help="Lists the available testcases.")
 def testcase_list():
     _testcase.list()
@@ -121,8 +108,11 @@ def testcase_show(testname):
 @click.option('-n', '--noclean', is_flag=True, default=False,
               help='The created openstack resources by the test'
               'will not be cleaned after the execution.')
-def testcase_run(testname, noclean):
-    _testcase.run(testname, noclean)
+@click.option('-r', '--report', is_flag=True, default=False,
+              help='Push results to the results DataBase. Only CI Pods'
+              'have rights to do that.')
+def testcase_run(testname, noclean, report):
+    _testcase.run(testname, noclean, report)
 
 
 @tier.command('list', help="Lists the available tiers.")
@@ -147,5 +137,8 @@ def tier_gettests(tiername):
 @click.option('-n', '--noclean', is_flag=True, default=False,
               help='The created openstack resources by the tests'
               'will not be cleaned after the execution.')
-def tier_run(tiername, noclean):
-    _tier.run(tiername, noclean)
+@click.option('-r', '--report', is_flag=True, default=False,
+              help='Push results to the results DataBase. Only CI Pods'
+              'have rights to do that.')
+def tier_run(tiername, noclean, report):
+    _tier.run(tiername, noclean, report)