rename --no-confirmation to --non-interactive
full test example:
$ atest host rename --non-interactive --for-migration `dut 2 4 6 11`
Successfully renamed:
chromeos2-row4-rack6-host11 to chromeos2-row4-rack6-host11-migrated-do-not-use
$ atest host rename --non-interactive --for-rollback `dut 2 4 6 11`-migrated-do-not-use
Successfully renamed:
chromeos2-row4-rack6-host11-migrated-do-not-use to chromeos2-row4-rack6-host11
BUG=None
TEST=atest rename --non-interactive --for-migration ...
Change-Id: I88f9170d9eef548a860100c1e608683d6b03f311
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1691762
Tested-by: Gregory Nisbet <gregorynisbet@google.com>
Reviewed-by: Gregory Nisbet <gregorynisbet@google.com>
Commit-Queue: Gregory Nisbet <gregorynisbet@google.com>
Auto-Submit: Gregory Nisbet <gregorynisbet@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
diff --git a/cli/host.py b/cli/host.py
index 8773b1e..93d73b9 100644
--- a/cli/host.py
+++ b/cli/host.py
@@ -1034,8 +1034,8 @@
help='Execute the action as a dryrun.',
action='store_true',
default=False)
- self.parser.add_option('--no-confirmation',
- help='do not prompt for confirmation',
+ self.parser.add_option('--non-interactive',
+ help='run non-interactively',
action='store_true',
default=False)
@@ -1046,7 +1046,7 @@
self.for_migration = options.for_migration
self.for_rollback = options.for_rollback
self.dryrun = options.dryrun
- self.require_confirmation = not options.no_confirmation
+ self.interactive = not options.non_interactive
self.host_ids = {}
if not (self.for_migration ^ self.for_rollback):
@@ -1064,8 +1064,11 @@
def execute(self):
"""Execute 'atest host rename'."""
- if self.require_confirmation and not self.prompt_confirmation():
- return
+ if self.interactive:
+ if self.prompt_confirmation():
+ pass
+ else:
+ return
successes = []
for host in self.execute_rpc('get_hosts', hostname__in=self.hosts):