devserver: remove temp directory for storing devserver codes.
Currently, when devserver tries to transfer devserver package, it first copies
the codes without some unneccesary files to a temp directory, then transfer the
whole package to device. This procedure will leave a temp directory on
devserver and won't be deleted after the provision succeeds or fails.
This CL helps the devserver to pass the temp directory to the auto_updater, and
then delete the directory after provision is finished.
BUG=chromium:654953
TEST=run repair with local autotest and devserver.
Change-Id: I4d0bd4516923a3bd41c455175ca36093e24266c1
Reviewed-on: https://chromium-review.googlesource.com/399989
Commit-Ready: Xixuan Wu <xixuan@chromium.org>
Tested-by: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Allen Li <ayatane@chromium.org>
diff --git a/devserver.py b/devserver.py
index ea0d70b..95b498b 100755
--- a/devserver.py
+++ b/devserver.py
@@ -41,7 +41,6 @@
from __future__ import print_function
-import glob
import json
import optparse
import os
@@ -917,7 +916,7 @@
@cherrypy.expose
def handler_cleanup(self, **kwargs):
- """Clean track status log for CrOS auto-update process.
+ """Clean track status log and temp directory for CrOS auto-update process.
Args:
kwargs:
@@ -933,6 +932,7 @@
host_name = kwargs['host_name']
pid = kwargs['pid']
cros_update_progress.DelTrackStatusFile(host_name, pid)
+ cros_update_progress.DelAUTempDirectory(host_name, pid)
@cherrypy.expose
def kill_au_proc(self, **kwargs):
@@ -949,8 +949,8 @@
raise common_util.DevServerHTTPError((KEY_ERROR_MSG % 'host_name'))
host_name = kwargs['host_name']
- file_filter = cros_update_progress.TRACK_LOG_FILE_PATH % (host_name, '*')
- track_log_list = glob.glob(file_filter)
+ track_log_list = cros_update_progress.GetAllTrackStatusFileByHostName(
+ host_name)
for log in track_log_list:
# The track log's full path is: path/host_name_pid.log
# Use splitext to remove file extension, then parse pid from the
@@ -984,11 +984,12 @@
host_name = kwargs['host_name']
pid = kwargs['pid']
+
+ # Fetch the execute log recorded by cros_update_progress.
au_log = cros_update_progress.ReadExecuteLogFile(host_name, pid)
cros_update_progress.DelExecuteLogFile(host_name, pid)
return au_log
-
@cherrypy.expose
def locate_file(self, **kwargs):
"""Get the path to the given file name.