[autotest] Add provisioning flag to autoserv.
autoserv now accepts a --provision flag that accepts a comma seperated
list of labels that it should provision the targeted machine(s) (via -m)
to. This list gets fed directly into the control segment, which handles
all of the processing of it and provisioning work.
It should also be loudly noted that since we run the provision control
segment as a normal test instead of directly executing the contents, one
cannot specify the -c flag, or else it will try to run the provision
control segment as a client-side test.
This is just some plumbing. It's pretty uneventful.
BUG=chromium:249437
TEST=The following:
1) Ran autoserv --provision cros-version:lumpy-release/R28-3993.0.0 and
the machine was provisioned correctly.
2) Ran autoserv -c --provision and received an error.
Change-Id: I03582a5210d182f171ef725c4e49cc83c1baf793
Reviewed-on: https://gerrit.chromium.org/gerrit/58384
Tested-by: Alex Miller <milleral@chromium.org>
Reviewed-by: Prashanth Balasubramanian <beeps@chromium.org>
Commit-Queue: Alex Miller <milleral@chromium.org>
diff --git a/server/autoserv b/server/autoserv
index d54aac0..f1f9565 100755
--- a/server/autoserv
+++ b/server/autoserv
@@ -82,6 +82,7 @@
verify = parser.options.verify
repair = parser.options.repair
cleanup = parser.options.cleanup
+ provision = parser.options.provision
no_tee = parser.options.no_tee
parse_job = parser.options.parse_job
execution_tag = parser.options.execution_tag
@@ -99,8 +100,12 @@
if client and server:
parser.parser.error("Can not specify a test as both server and client!")
- if len(parser.args) < 1 and not (verify or repair or cleanup
- or collect_crashinfo):
+ if provision and client:
+ parser.parser.error("Cannot specify provisioning and client!")
+
+ is_special_task = (verify or repair or cleanup or collect_crashinfo or
+ provision)
+ if len(parser.args) < 1 and not is_special_task:
parser.parser.error("Missing argument: control file")
# We have a control file unless it's just a verify/repair/cleanup job
@@ -151,6 +156,8 @@
job.repair(host_protection)
elif verify:
job.verify()
+ elif provision:
+ job.provision(provision)
else:
job.run(cleanup, install_before, install_after,
only_collect_crashinfo=collect_crashinfo)