[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 <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/server/site_utils.py b/server/site_utils.py
index 2d2d050..1ebff49 100644
--- a/server/site_utils.py
+++ b/server/site_utils.py
@@ -670,4 +670,24 @@
 def verify_not_root_user():
     """Simple function to error out if running with uid == 0"""
     if os.getuid() == 0:
-        raise error.IllegalUser('This script can not be ran as root.')
\ No newline at end of file
+        raise error.IllegalUser('This script can not be ran as root.')
+
+
+def get_hostname_from_machine(machine):
+    """Lookup hostname from a machine string or dict.
+
+    @returns: Machine hostname in string format.
+    """
+    hostname, _ = get_host_info_from_machine(machine)
+    return hostname
+
+
+def get_host_info_from_machine(machine):
+    """Lookup host information from a machine string or dict.
+
+    @returns: Tuple of (hostname, host_attributes)
+    """
+    if isinstance(machine, dict):
+        return (machine['hostname'], machine['host_attributes'])
+    else:
+        return (machine, {})