Moblab: Display 'moblab' user as default in AFE.

Currently there are 2 separate users for Moblab: 'default_user' for
kicking off jobs from the AFE and 'moblab' for kicking off jobs from
the run_suite command.

This change defaults the AFE to use 'moblab'. And allows jobs to be
aborted from the AFE.

BUG=chromium:358579
TEST=Moblab AFE defaults to 'moblab' user and is able to abort jobs
created by run_suite. Also verified get_current_board() still works
on a moblab.

Change-Id: Ic9a0a7bfc745a670796863629d070056e1dfd69f
Reviewed-on: https://chromium-review.googlesource.com/193657
Reviewed-by: Prashanth B <beeps@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
diff --git a/client/common_lib/site_utils.py b/client/common_lib/site_utils.py
index 1a116c7..a85b105 100644
--- a/client/common_lib/site_utils.py
+++ b/client/common_lib/site_utils.py
@@ -101,19 +101,44 @@
     return None
 
 
+def _lsbrelease_search(regex, group_id=0):
+    """Searches /etc/lsb-release for a regex match.
+
+    @param regex: Regex to match.
+    @param group_id: The group in the regex we are searching for.
+                     Default is group 0.
+
+    @returns the string in the specified group if there is a match or None if
+             not found.
+
+    @raises IOError if /etc/lsb-release can not be accessed.
+    """
+    with open(constants.LSB_RELEASE) as lsb_release_file:
+        for line in lsb_release_file:
+            m = re.match(regex, line)
+            if m:
+                return m.group(group_id)
+    return None
+
+
 def get_current_board():
     """Return the current board name.
 
     @return current board name, e.g "lumpy", None on fail.
     """
-    with open('/etc/lsb-release') as lsb_release_file:
-        for line in lsb_release_file:
-            m = re.match(r'^CHROMEOS_RELEASE_BOARD=(.+)$', line)
-            if m:
-                return m.group(1)
-    return None
+    return _lsbrelease_search(r'^CHROMEOS_RELEASE_BOARD=(.+)$', group_id=1)
 
 
+def is_moblab():
+    """Return if we are running on a Moblab system or not.
+
+    @return the board string if this is a Moblab device or None if it is not.
+    """
+    try:
+        return _lsbrelease_search(r'.*moblab')
+    except IOError as e:
+        logging.error('Unable to determine if this is a moblab system: %s', e)
+
 # TODO(petermayo): crosbug.com/31826 Share this with _GsUpload in
 # //chromite.git/buildbot/prebuilt.py somewhere/somehow
 def gs_upload(local_file, remote_file, acl, result_dir=None,