diff options
Diffstat (limited to 'anta/cli/nrfu/__init__.py')
-rw-r--r-- | anta/cli/nrfu/__init__.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/anta/cli/nrfu/__init__.py b/anta/cli/nrfu/__init__.py index bbb2982..6a67e60 100644 --- a/anta/cli/nrfu/__init__.py +++ b/anta/cli/nrfu/__init__.py @@ -99,6 +99,14 @@ HIDE_STATUS.remove("unset") help="Group result by test or device.", required=False, ) +@click.option( + "--dry-run", + help="Run anta nrfu command but stop before starting to execute the tests. Considers all devices as connected.", + type=str, + show_envvar=True, + is_flag=True, + default=False, +) # pylint: disable=too-many-arguments def nrfu( ctx: click.Context, @@ -111,6 +119,7 @@ def nrfu( *, ignore_status: bool, ignore_error: bool, + dry_run: bool, ) -> None: """Run ANTA tests on selected inventory devices.""" # If help is invoke somewhere, skip the command @@ -124,7 +133,19 @@ def nrfu( ctx.obj["hide"] = set(hide) if hide else None print_settings(inventory, catalog) with anta_progress_bar() as AntaTest.progress: - asyncio.run(main(ctx.obj["result_manager"], inventory, catalog, tags=tags, devices=set(device) if device else None, tests=set(test) if test else None)) + asyncio.run( + main( + ctx.obj["result_manager"], + inventory, + catalog, + tags=tags, + devices=set(device) if device else None, + tests=set(test) if test else None, + dry_run=dry_run, + ) + ) + if dry_run: + return # Invoke `anta nrfu table` if no command is passed if ctx.invoked_subcommand is None: ctx.invoke(commands.table) |