Modify the controlfiles pathway to no longer use
build and board as seperate entities.
The build is in fact the board/build-info.
Remove controlfile and download from the CherryPy config.
request.process_request_body has to do with storing requests with
rfile in memory or not. Neither of these pathways utilize this.
Add a bit more error handling with a pointer to coming up with a more
reasonable solution. Please keep discussions regarding that on bug:
crosbug.com/25040
TEST=Ran local tests
BUG=None
Change-Id: Ib8e9244c4865daae356e97da6412c7972239b184
Reviewed-on: https://gerrit.chromium.org/gerrit/14159
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Ready: Scott Zawalski <scottz@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Scott Zawalski <scottz@chromium.org>
diff --git a/devserver_util.py b/devserver_util.py
index a8cfb65..4c41571 100644
--- a/devserver_util.py
+++ b/devserver_util.py
@@ -387,12 +387,12 @@
return dev_build_dir
-def GetControlFile(static_dir, board, build, control_path):
+
+def GetControlFile(static_dir, build, control_path):
"""Attempts to pull the requested control file from the Dev Server.
Args:
static_dir: Directory where builds are served from.
- board: Fully qualified board name; e.g. x86-generic-release.
build: Fully qualified build string; e.g. R17-1234.0.0-a1-b983.
control_path: Path to control file on Dev Server relative to Autotest root.
@@ -402,21 +402,25 @@
Returns:
Content of the requested control file.
"""
- control_path = os.path.join(static_dir, board, build, 'autotest',
+ control_path = os.path.join(static_dir, build, 'autotest',
control_path)
if not SafeSandboxAccess(static_dir, control_path):
raise DevServerUtilError('Invaid control file "%s".' % control_path)
+ if not os.path.exists(control_path):
+ # TODO(scottz): Come up with some sort of error mechanism.
+ # crosbug.com/25040
+ return 'Unknown control path %s' % control_path
+
with open(control_path, 'r') as control_file:
return control_file.read()
-def GetControlFileList(static_dir, board, build):
+def GetControlFileList(static_dir, build):
"""List all control|control. files in the specified board/build path.
Args:
static_dir: Directory where builds are served from.
- board: Fully qualified board name; e.g. x86-generic-release.
build: Fully qualified build string; e.g. R17-1234.0.0-a1-b983.
Raises:
@@ -425,13 +429,16 @@
Returns:
String of each file separated by a newline.
"""
- autotest_dir = os.path.join(static_dir, board, build, 'autotest')
+ autotest_dir = os.path.join(static_dir, build, 'autotest')
if not SafeSandboxAccess(static_dir, autotest_dir):
raise DevServerUtilError('Autotest dir not in sandbox "%s".' % autotest_dir)
control_files = set()
- control_paths = ['testsuite', 'server/tests', 'server/site_tests',
- 'client/tests', 'client/site_tests']
+ if not os.path.exists(autotest_dir):
+ # TODO(scottz): Come up with some sort of error mechanism.
+ # crosbug.com/25040
+ return 'Unknown build path %s' % autotest_dir
+
for entry in os.walk(autotest_dir):
dir_path, _, files = entry
for file_entry in files: