autoupdate.py: Don't try to to fetch update payloads

All autotests we run first stage their update payloads before calling
into devserver. This CL removes the dance that autoupdate.py is doing to
get the exact path to the image because that's not needed anymore. We
only need the path to the directory where the payloads are located. The
nebraska.py knows how to find the correct payloads from that directory.

BUG=chromium:1149703
TEST=run devserver locally, then staged delta payloads:
curl 'http://localhost:8080/stage?archive_url=gs://chromeos-image-archive/reef-release/R88-13591.0.0&artifacts=delta_payload'

Then got a noupdate for this URL:
curl -X POST -d @/mnt/host/source/images/request.xml 'http://localhost:8080/update/reef-release/R88-13591.0.0?full_payload=True&critical_update=True

Got an update for this URL:
curl -X POST -d @/mnt/host/source/images/request.xml 'http://localhost:8080/update/reef-release/R88-13591.0.0?full_payload=False&critical_update=True

Change-Id: I301a799a6b41eeb9b3164806e5d2038e7efb8f1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2570637
Tested-by: Amin Hassani <ahassani@chromium.org>
Auto-Submit: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
diff --git a/autoupdate.py b/autoupdate.py
index 88def64..b567e11 100644
--- a/autoupdate.py
+++ b/autoupdate.py
@@ -24,7 +24,6 @@
 
 import setup_chromite  # pylint: disable=unused-import
 from chromite.lib.xbuddy import cherrypy_log_util
-from chromite.lib.xbuddy import devserver_constants as constants
 
 
 # Module-local log function.
@@ -70,33 +69,6 @@
     self.xbuddy = xbuddy
     self.static_dir = static_dir
 
-  def GetUpdateForLabel(self, label):
-    """Given a label, get an update from the directory.
-
-    Args:
-      label: the relative directory inside the static dir
-
-    Returns:
-      A relative path to the directory with the update payload.
-      This is the label if an update did not need to be generated, but can
-      be label/cache/hashed_dir_for_update.
-
-    Raises:
-      AutoupdateError: If client version is higher than available update found
-        at the directory given by the label.
-    """
-    _Log('Update label: %s', label)
-    static_update_path = _NonePathJoin(self.static_dir, label,
-                                       constants.UPDATE_FILE)
-
-    if label and os.path.exists(static_update_path):
-      # An update payload was found for the given label, return it.
-      return label
-
-    # The label didn't resolve.
-    _Log('Did not found any update payload for label %s.', label)
-    return None
-
   def GetDevserverUrl(self):
     """Returns the devserver url base."""
     x_forwarded_host = cherrypy.request.headers.get('X-Forwarded-Host')
@@ -136,30 +108,14 @@
     """
     label = label or ''
     label_list = label.split('/')
-    # Suppose that the path follows old protocol of indexing straight
-    # into static_dir with board/version label.
-    # Attempt to get the update in that directory, generating if necc.
-    path_to_payload = self.GetUpdateForLabel(label)
-    if path_to_payload is None:
-      # There was no update found in the directory. Let XBuddy find the
-      # payloads.
-      if label_list[0] == 'xbuddy':
-        # If path explicitly calls xbuddy, pop off the tag.
-        label_list.pop()
-      x_label, _ = self.xbuddy.Translate(label_list, board=board)
-      # Path has been resolved, try to get the payload.
-      path_to_payload = self.GetUpdateForLabel(x_label)
-      if path_to_payload is None:
-        # No update payload found after translation. Try to get an update to
-        # a test image from GS using the label.
-        path_to_payload, _image_name = self.xbuddy.Get(
-            ['remote', label, 'full_payload'])
-
-    # One of the above options should have gotten us a relative path.
-    if path_to_payload is None:
-      raise AutoupdateError('Failed to get an update for: %s' % label)
-
-    return path_to_payload
+    # There was no update found in the directory. Let XBuddy find the
+    # payloads.
+    if label_list[0] == 'xbuddy':
+      # If path explicitly calls xbuddy, pop off the tag.
+      label_list.pop()
+    x_label, _ = self.xbuddy.Translate(label_list, board=board)
+    # Path has been resolved, try to get the payload.
+    return _NonePathJoin(self.static_dir, x_label)
 
   def HandleUpdatePing(self, data, label='', **kwargs):
     """Handles an update ping from an update client.