Remove need for single_item when calling GetGSNamesWithWait
BUG=chromium:286453
TEST=Ran it with new devserver code.
Change-Id: I7cb235f16723b7720bdfc4c7019d2d59f34892c7
Previous-Reviewed-on: https://chromium-review.googlesource.com/168474
(cherry picked from commit 728736163fe2ec04c8eb93b27bf4070e5dad1f05)
Reviewed-on: https://chromium-review.googlesource.com/174416
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
diff --git a/site_utils/autoupdate/test_image.py b/site_utils/autoupdate/test_image.py
index e39cded..eb5e7a8 100644
--- a/site_utils/autoupdate/test_image.py
+++ b/site_utils/autoupdate/test_image.py
@@ -36,6 +36,10 @@
pass
+class NotSingleItem(Exception):
+ """Raised when we want a single item but got multiple."""
+
+
def get_default_archive_url(board, build_version):
"""Returns the default archive_url for the given board and build_version .
@@ -82,11 +86,13 @@
logging.debug('Searching for pattern %s from url %s', pattern,
archive_url)
uri_list = gsutil_util.GetGSNamesWithWait(
- pattern, archive_url, err_str=__name__, single_item=single,
- timeout=1)
+ pattern, archive_url, err_str=__name__, timeout=1)
# Convert to the format our clients expect (full archive path).
if uri_list:
- return ['/'.join([archive_url, u]) for u in uri_list]
+ if not single or (single and len(uri_list) == 1):
+ return ['/'.join([archive_url, u]) for u in uri_list]
+ else:
+ raise NotSingleItem()
return []
except gsutil_util.PatternNotSpecific as e:
@@ -110,9 +116,9 @@
"""
if delta:
- pattern = '.*_delta_.*'
+ pattern = '*_delta_*'
else:
- pattern = '.*_full_.*'
+ pattern = '*_full_*'
payload_uri_list = gs_ls(pattern, archive_url, single)
if not payload_uri_list: