devserver: Remove unused APIs

remove for_update use case as devserver is not being used to generate
update payloads anymore.

Remove the xbuddy_list API as there is no use case for this either.

BUG=chromium:1008058
TEST=./devserver_integration_test.py

Change-Id: Idb8fb6d5c42bb1555611d241fb031d21fb4707b1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2485248
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
diff --git a/devserver.py b/devserver.py
index acd4cdf..c25191c 100755
--- a/devserver.py
+++ b/devserver.py
@@ -990,10 +990,6 @@
           xbuddy, defined in xbuddy:ALIASES. Defaults to test.
 
     Kwargs:
-      for_update: {true|false}
-                  if true, prepares the update payloads for the image,
-                  and returns the update uri to pass to the
-                  update_engine_client.
       return_dir: {true|false}
                   if set to true, returns the url to the update.gz
       relative_path: {true|false}
@@ -1005,10 +1001,6 @@
       http://host:port/xbuddy/x86-generic/R26-4000.0.0/test?return_dir=true
 
     Returns:
-      If |for_update|, returns a redirect to the image or update file
-      on the devserver. E.g.,
-        http://host:port/static/archive/x86-generic-release/R26-4000.0.0/
-            chromium-test-image.bin
       If |return_dir|, return a uri to the folder where the artifact is. E.g.,
         http://host:port/static/x86-generic-release/R26-4000.0.0/
       If |relative_path| is true, return a relative path the folder where the
@@ -1018,8 +1010,6 @@
     if is_deprecated_server():
       raise DeprecatedRPCError('xbuddy')
 
-    boolean_string = kwargs.get('for_update')
-    for_update = xbuddy.XBuddy.ParseBoolean(boolean_string)
     boolean_string = kwargs.get('return_dir')
     return_dir = xbuddy.XBuddy.ParseBoolean(boolean_string)
     boolean_string = kwargs.get('relative_path')
@@ -1030,22 +1020,7 @@
           http_client.INTERNAL_SERVER_ERROR,
           'Cannot specify both return_dir and relative_path')
 
-    # For updates, we optimize downloading of test images.
-    file_name = None
-    build_id = None
-    if for_update:
-      try:
-        build_id = self._xbuddy.StageTestArtifactsForUpdate(args)
-      except build_artifact.ArtifactDownloadError:
-        build_id = None
-
-    if not build_id:
-      build_id, file_name = self._xbuddy.Get(args)
-
-    if for_update:
-      _Log('Payloads requested.')
-      # Forces payload to be in cache and symlinked into build_id dir.
-      updater.GetUpdateForLabel(build_id)
+    build_id, file_name = self._xbuddy.Get(args)
 
     response = None
     if return_dir:
@@ -1054,9 +1029,6 @@
     elif relative_path:
       response = build_id
       _Log('Relative path requested, returning: %s', response)
-    elif for_update:
-      response = os.path.join(cherrypy.request.base, 'update', build_id)
-      _Log('Update URI requested, returning: %s', response)
     else:
       # Redirect to download the payload if no kwargs are set.
       build_id = '/' + os.path.join('static', build_id, file_name)
@@ -1066,19 +1038,6 @@
     return response
 
   @cherrypy.expose
-  def xbuddy_list(self):
-    """Lists the currently available images & time since last access.
-
-    Returns:
-      A string representation of a list of tuples [(build_id, time since last
-      access),...]
-    """
-    if is_deprecated_server():
-      raise DeprecatedRPCError('xbuddy')
-
-    return self._xbuddy.List()
-
-  @cherrypy.expose
   def xbuddy_capacity(self):
     """Returns the number of images cached by xBuddy."""
     if is_deprecated_server():
diff --git a/devserver_integration_test.py b/devserver_integration_test.py
index 14a2c2a..64a492f 100755
--- a/devserver_integration_test.py
+++ b/devserver_integration_test.py
@@ -386,12 +386,6 @@
                                relative_path=True)
       self.assertEqual(response, build_id)
 
-    xbuddy_path = '/'.join([build_id, 'test'])
-    logging.info('Testing for_update for %s', xbuddy_path)
-    response = self._MakeRPC('/'.join([XBUDDY, xbuddy_path]), for_update=True)
-    expected_path = '/'.join([self.devserver_url, UPDATE, build_id])
-    self.assertTrue(response, expected_path)
-
     logging.info('Verifying the actual payload data')
     url = self.VerifyHandleUpdate(build_id, use_test_payload=False)
     logging.info('Verify the actual content of the update payload')
@@ -488,12 +482,6 @@
     expected_static_url = '/'.join([self.devserver_url, STATIC, build_id])
     self.assertEqual(response, expected_static_url)
 
-    logging.info('Checking for_update returns an update_url for what we just '
-                 'staged.')
-    expected_update_url = '/'.join([self.devserver_url, UPDATE, build_id])
-    response = self._MakeRPC('/'.join([XBUDDY, xbuddy_path]), for_update=True)
-    self.assertEqual(response, expected_update_url)
-
     logging.info('Now give xbuddy a bad path.')
     self.assertRaises(requests.exceptions.RequestException,
                       self._MakeRPC,