devserver: Deprecate fileinfo API

This is not used by AU tests anymore.

BUG=chromium:1054529
TEST=devserver_integration_test.py

Change-Id: If6e689e32eab1337d89bbdf92b5ae16d8c42e6c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2095982
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Keith Haddow <haddowk@chromium.org>
Commit-Queue: Keith Haddow <haddowk@chromium.org>
diff --git a/devserver.py b/devserver.py
index f5aaac8..fbaa771 100755
--- a/devserver.py
+++ b/devserver.py
@@ -112,7 +112,8 @@
 
     :param rpc_name: (str) name of the RPC that has been deprecated.
     """
-    super(DeprecatedRPCError, self).__init__(DEPRECATED_RPC_ERROR_MSG % rpc_name)
+    super(DeprecatedRPCError, self).__init__(
+        DEPRECATED_RPC_ERROR_MSG % rpc_name)
     self.rpc_name = rpc_name
 
 
@@ -576,45 +577,6 @@
     """
     return updater.HandleHostLogPing(ip)
 
-  @cherrypy.expose
-  def fileinfo(self, *args):
-    """Returns information about a given staged file.
-
-    Args:
-      args: path to the file inside the server's static staging directory
-
-    Returns:
-      A JSON encoded dictionary with information about the said file, which may
-      contain the following keys/values:
-        size (int):      the file size in bytes
-        sha256 (string): a base64 encoded SHA256 hash
-
-    Example URL:
-      http://myhost/api/fileinfo/some/path/to/file
-    """
-    if is_deprecated_server():
-      raise DeprecatedRPCError('fileinfo')
-
-    # TODO(ahassani): A better way of doing this is to just return the the
-    # content of the payloads' property file instead. That has all this info
-    # except that the key for sha256 is 'sha256_hex', but still base64 encdoed.
-
-    file_path = os.path.join(updater.static_dir, *args)
-    if not os.path.exists(file_path):
-      raise DevServerError('file not found: %s' % file_path)
-    try:
-      file_size = os.path.getsize(file_path)
-      file_sha256 = common_util.GetFileSha256(file_path)
-    except os.error as e:
-      raise DevServerError(
-          'failed to get info for file %s: %s' % (file_path, e))
-
-    return json.dumps({
-        'size': file_size,
-        'sha256': file_sha256,
-    }, sort_keys=True)
-
-
 class DevServerRoot(object):
   """The Root Class for the Dev Server.
 
diff --git a/devserver_integration_test.py b/devserver_integration_test.py
index fbde817..8464b20 100755
--- a/devserver_integration_test.py
+++ b/devserver_integration_test.py
@@ -412,16 +412,6 @@
     self.assertTrue(process.is_running())
     self.assertIn('./devserver.py', process.cmdline())
 
-  def testFileInfo(self):
-    """Verifies the fileinfo API."""
-    response = self._MakeRPC('/'.join(['api', 'fileinfo', LABEL,
-                                       TEST_UPDATE_PAYLOAD_NAME]))
-    self.assertEqual(
-        response,
-        '{"sha256": "hgfZ19hcsA5OGUN3f4SDtoO0kzT24o+JsGgjNVCVEy0=", '
-        '"size": 36}')
-
-
 class DevserverExtendedTests(AutoStartDevserverTestBase):
   """Longer running integration tests that test interaction with Google Storage.