future/settings: Migrate archive to use the new future/settings API

As part of the effort to remove default values scattered around the
code, this change only migrates the archive plugin options to use the
new module. This will associate the --archive command line option with
run.results.archive in the configuration file.
Signed-off-by: NBeraldo Leal <bleal@redhat.com>
上级 4df9767d
......@@ -14,6 +14,7 @@
"""Result Archive Plugin"""
from avocado.core.future.settings import settings
from avocado.core.plugin_interfaces import CLI, Result
from avocado.utils import archive
......@@ -24,7 +25,7 @@ class Archive(Result):
description = 'Result archive (ZIP) support'
def render(self, result, job):
if job.config.get('archive', False):
if job.config.get('run.results.archive'):
archive.compress("%s.zip" % job.logdir, job.logdir)
......@@ -38,10 +39,15 @@ class ArchiveCLI(CLI):
if run_subcommand_parser is None:
return
run_subcommand_parser.output.add_argument(
'-z', '--archive', action='store_true',
dest='archive', default=False,
help='Archive (ZIP) files generated by tests')
help_msg = 'Archive (ZIP) files generated by tests'
settings.register_option(section='run.results',
key='archive',
default=False,
help_msg=help_msg,
key_type=bool,
parser=run_subcommand_parser,
short_arg='-z',
long_arg='--archive')
def run(self, config):
pass
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册