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 @@ ...@@ -14,6 +14,7 @@
"""Result Archive Plugin""" """Result Archive Plugin"""
from avocado.core.future.settings import settings
from avocado.core.plugin_interfaces import CLI, Result from avocado.core.plugin_interfaces import CLI, Result
from avocado.utils import archive from avocado.utils import archive
...@@ -24,7 +25,7 @@ class Archive(Result): ...@@ -24,7 +25,7 @@ class Archive(Result):
description = 'Result archive (ZIP) support' description = 'Result archive (ZIP) support'
def render(self, result, job): 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) archive.compress("%s.zip" % job.logdir, job.logdir)
...@@ -38,10 +39,15 @@ class ArchiveCLI(CLI): ...@@ -38,10 +39,15 @@ class ArchiveCLI(CLI):
if run_subcommand_parser is None: if run_subcommand_parser is None:
return return
run_subcommand_parser.output.add_argument( help_msg = 'Archive (ZIP) files generated by tests'
'-z', '--archive', action='store_true', settings.register_option(section='run.results',
dest='archive', default=False, key='archive',
help='Archive (ZIP) files generated by tests') default=False,
help_msg=help_msg,
key_type=bool,
parser=run_subcommand_parser,
short_arg='-z',
long_arg='--archive')
def run(self, config): def run(self, config):
pass pass
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册