From 2cffa0e15d05b5b03aa46b4ec3d922a7f1ed0890 Mon Sep 17 00:00:00 2001 From: Beraldo Leal Date: Fri, 7 Feb 2020 14:51:39 -0300 Subject: [PATCH] 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: Beraldo Leal --- avocado/plugins/archive.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/avocado/plugins/archive.py b/avocado/plugins/archive.py index 8b44d47d..0261d01c 100644 --- a/avocado/plugins/archive.py +++ b/avocado/plugins/archive.py @@ -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 -- GitLab