devserver: Update collect_cros_au_log RPC to return the host logs.

The collect_cros_au_log RPC currently returns just the executing log.
We will need it to return the host logs saved during the update so that
the autoupdate_EndToEndTest test can analyse them.

BUG=chromium:709710
TEST=dev_server.auto_update() and verify that the host logs are saved
into job.resultdir when the test is finished.

Change-Id: I7cf14a81da5481ba8474de9cf1d115280eb93dda
Reviewed-on: https://chromium-review.googlesource.com/503616
Commit-Ready: David Haddock <dhaddock@chromium.org>
Tested-by: David Haddock <dhaddock@chromium.org>
Reviewed-by: Xixuan Wu <xixuan@chromium.org>
diff --git a/cros_update_progress.py b/cros_update_progress.py
index 72b872a..c337e0a 100644
--- a/cros_update_progress.py
+++ b/cros_update_progress.py
@@ -57,6 +57,8 @@
 # update engine log.
 _CROS_UPDATE_TEMP_PATH = '/tmp/cros-update_%s_%s'
 
+_CROS_HOSTLOG_PATTERN = 'devserver_hostlog*'
+
 # The string for update process finished
 FINISHED = 'Completed'
 ERROR_TAG = 'Error'
@@ -186,6 +188,16 @@
   return osutils.ReadFile(GetExecuteLogFile(host_name, pid))
 
 
+def ReadAUHostLogFiles(host_name, pid):
+  """Returns a dictionary containing the devserver host log files."""
+  au_dir = GetAUTempDirectory(host_name, pid)
+  hostlog_filenames = glob.glob(os.path.join(au_dir, _CROS_HOSTLOG_PATTERN))
+  hostlog_files = {}
+  for f in hostlog_filenames:
+    hostlog_files[os.path.basename(f)] = osutils.ReadFile(f)
+  return hostlog_files
+
+
 def DelTrackStatusFile(host_name, pid):
   """Delete the track status log."""
   osutils.SafeUnlink(GetTrackStatusFile(host_name, pid))