Change list_suite_controls to return a dictionary of file_path:content
File path is needed to parse the test name.
BUG=chromium:602562
TEST=local run devserver
curl http://127.0.0.1:8080/list_suite_controls?suite_name=suite_attr_wrapper\&build=veyron_jerry-release/R51-8099.0.0
curl http://127.0.0.1:8080/stage?archive_url=gs://chromeos-image-archive/veyron_jerry-release/R51-8099.0.0/\&artifacts=test_suites,control_files
Change-Id: I13ff3811ceaff71fb054a0981e2d659d1d61c6a3
Reviewed-on: https://chromium-review.googlesource.com/339500
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Xixuan Wu <xixuan@chromium.org>
diff --git a/devserver.py b/devserver.py
index 26a46d3..9b8b395 100755
--- a/devserver.py
+++ b/devserver.py
@@ -945,7 +945,7 @@
suite_name: List the control files belonging to that suite.
Returns:
- A list of contents of all control files are provided.
+ A dictionary of all control files's path to its content for given suite.
"""
if not kwargs:
return _PrintDocStringAsHTML(self.controlfiles)
@@ -954,19 +954,20 @@
raise common_util.DevServerHTTPError(500, 'Error: build= is required!')
if 'suite_name' not in kwargs:
- raise common_util.DevServerHTTPError(500, 'Error: suite_name= is required!')
+ raise common_util.DevServerHTTPError(500,
+ 'Error: suite_name= is required!')
control_file_list = [
line.rstrip() for line in common_util.GetControlFileListForSuite(
updater.static_dir, kwargs['build'],
kwargs['suite_name']).splitlines()]
- control_file_content_list = []
+ control_file_content_dict = {}
for control_path in control_file_list:
- control_file_content_list.append(common_util.GetControlFile(
+ control_file_content_dict[control_path] = (common_util.GetControlFile(
updater.static_dir, kwargs['build'], control_path))
- return json.dumps(control_file_content_list)
+ return json.dumps(control_file_content_dict)
@cherrypy.expose
def controlfiles(self, **kwargs):