[autotest] autoserv add --lab & --host_attributes arguments
Added two new flags to autoserv.
--lab indicates that autoserv is running in the lab and has
the full Autotest infrastructure at its disposal.
--host_attributes allows host attribute information that is
usually in the database to be retrievable from the command
line arguments.
If --lab is pulled in, autoserv will request the host attributes
from the database at test runtime.
From here this change, then updates the concept of the "machines"
list that test control files receive to now be a list of dicts
that contain the machine hostname and host attributes. This will
enable identifing information the hosts library needs to create
host objects to be available whether or not there is a database
present.
BUG=chromium:564343
TEST=local autoserv runs. Also verified scheduler changes work
via MobLab. waiting on trybot results.
DEPLOY=scheduler
Change-Id: I6021de11317e29e2e6c084d863405910c7d1a71d
Reviewed-on: https://chromium-review.googlesource.com/315230
Commit-Ready: Simran Basi <[email protected]>
Tested-by: Simran Basi <[email protected]>
Reviewed-by: Simran Basi <[email protected]>
diff --git a/server/autoserv_utils.py b/server/autoserv_utils.py
index 3275fb4..3a11cca 100644
--- a/server/autoserv_utils.py
+++ b/server/autoserv_utils.py
@@ -28,7 +28,8 @@
ssh_verbosity=0,
no_console_prefix=False,
ssh_options=None,
- use_packaging=True):
+ use_packaging=True,
+ in_lab=False):
"""
Construct an autoserv command from a job or host queue entry.
@@ -56,6 +57,10 @@
@param ssh_options: A string giving extra arguments to be tacked on to
ssh commands.
@param use_packaging Enable install modes that use the packaging system.
+ @param in_lab: If true, informs autoserv it is running within a lab
+ environment. This information is useful as autoserv knows
+ the database is available and can make database calls such
+ as looking up host attributes at runtime.
@returns The autoserv command line as a list of executable + parameters.
@@ -114,6 +119,9 @@
if not use_packaging:
command.append('--no_use_packaging')
+ if in_lab:
+ command.extend(['--lab', 'True'])
+
return command + extra_args