Devserver update rpc: translate xBuddy paths.
If an update request starts with 'xbuddy' the rest of the path will be
translated to a directory within the devserver's static_dir before being
passed onto the normal update call.
BUG=chromium:261671
TEST=Effectively None, as there aren't any scripts that use the update
rpc with xBuddy yet. :(
Can call http://host:port/update/xbuddy/board/version/ to see that the
translation happens, but without the xml, this isn't meaningful yet.
Change-Id: I072ba04045a30b3c7d03d67556f9f9d0c7af41ec
Reviewed-on: https://gerrit.chromium.org/gerrit/63282
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Joy Chen <joychen@chromium.org>
Reviewed-by: Joy Chen <joychen@chromium.org>
Tested-by: Joy Chen <joychen@chromium.org>
diff --git a/devserver.py b/devserver.py
index faec8a1..5b82608 100755
--- a/devserver.py
+++ b/devserver.py
@@ -792,7 +792,15 @@
Example:
http://myhost/update/optional/path/to/payload
"""
- label = '/'.join(args)
+ if len(args) > 0 and args[0] == 'xbuddy':
+ # Interpret the rest of the path as an xbuddy path
+ label, found = self._xbuddy.Translate(args[1:] + ('full_payload',))
+ if not found:
+ _Log("Update payload not found for %s, xBuddy looking it up.", label)
+ else:
+ label = '/'.join(args)
+
+ _Log('Update label: %s', label)
body_length = int(cherrypy.request.headers.get('Content-Length', 0))
data = cherrypy.request.rfile.read(body_length)
return updater.HandleUpdatePing(data, label)