[autotest] add an --ssh_verbosity flag to autoserv
This CL adds an autoserv flag to tune the ssh logging verbosity. This is
accomplished by adding a global process-wide GLOBAL_SSH_COMMAND_OPTIONS
variable to site_host, to which autoserv tacks on a '-v' or '-vv' or
'-vvv' string if necessary. This is, admittedly, a little dirty. But the
make_ssh_command does not take a host object as an argument, so to add a
option host-wide to ssh_commands at the host object level would require
some major changes.
BUG=chromium:271621
TEST=Manually ran client/tests/dummy_Pass with various --ssh_verbosity
values, both valid and invalid. Saw that desired ssh verbosity was
realized.
Change-Id: If705c03f9d9d70de89642f42904e2e9fdc40bf61
Reviewed-on: https://gerrit.chromium.org/gerrit/65625
Tested-by: Aviv Keshet <akeshet@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Aviv Keshet <akeshet@chromium.org>
diff --git a/server/autoserv b/server/autoserv
index 3f6333b..513d0dd 100755
--- a/server/autoserv
+++ b/server/autoserv
@@ -105,6 +105,7 @@
test_retry = parser.options.test_retry
verify_job_repo_url = parser.options.verify_job_repo_url
skip_crash_collection = parser.options.skip_crash_collection
+ ssh_verbosity = int(parser.options.ssh_verbosity)
# can't be both a client and a server side test
if client and server:
@@ -118,6 +119,11 @@
if len(parser.args) < 1 and not is_special_task:
parser.parser.error("Missing argument: control file")
+ if ssh_verbosity > 0:
+ # ssh_verbosity is an integer between 0 and 3, inclusive
+ ssh_verbosity_flag = '-' + 'v' * ssh_verbosity
+ site_host.GLOBAL_SSH_COMMAND_OPTIONS += ssh_verbosity_flag
+
# We have a control file unless it's just a verify/repair/cleanup job
if len(parser.args) > 0:
control = parser.args[0]