Reland "Make the mton payload optional when staging artifacts."
Make the mton payload optional when staging artifacts.
Also fixes a bug where multiple wait_for_status calls
would not block.
Originally reviewed in: Ib6704594806de33cea38beb968e30304f1529211
BUG=chromium-os:29192
TEST=Unittests and run locally with x86-zgb-release/R20-2110.0.0-a1-b1695
Change-Id: I5052c0f095157c6f72bf84cbca34fe107eb8bf7a
Reviewed-on: https://gerrit.chromium.org/gerrit/20014
Tested-by: Chris Sosa <[email protected]>
Reviewed-by: Scott Zawalski <[email protected]>
Commit-Ready: Chris Sosa <[email protected]>
diff --git a/devserver.py b/devserver.py
index 3b606ea..bb22e22 100755
--- a/devserver.py
+++ b/devserver.py
@@ -1,12 +1,13 @@
#!/usr/bin/python
-# Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved.
+# Copyright (c) 2009-2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""A CherryPy-based webserver to host images and build packages."""
import cherrypy
+import logging
import optparse
import os
import re
@@ -227,8 +228,15 @@
if not archive_url:
raise DevServerError("Didn't specify the archive_url in request")
- return_obj = downloader_instance.Download(archive_url, background=True)
+ # Do this before we start such that other calls to the downloader or
+ # wait_for_status are blocked until this completed/failed.
self._downloader_dict[archive_url] = downloader_instance
+ try:
+ return_obj = downloader_instance.Download(archive_url, background=True)
+ except:
+ self._downloader_dict[archive_url] = None
+ raise
+
return return_obj
@cherrypy.expose
@@ -248,12 +256,15 @@
downloader_instance = self._downloader_dict.get(archive_url)
if downloader_instance:
+ status = downloader_instance.GetStatusOfBackgroundDownloads()
self._downloader_dict[archive_url] = None
- return downloader_instance.GetStatusOfBackgroundDownloads()
+ return status
else:
# We may have previously downloaded but removed the downloader instance
# from the cache.
if downloader.Downloader.BuildStaged(archive_url, updater.static_dir):
+ logging.info('%s not found in downloader cache but previously staged.',
+ archive_url)
return 'Success'
else:
raise DevServerError('No download for the given archive_url found.')