Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3302)

Unified Diff: appengine/swarming/handlers_endpoints.py

Issue 2374463002: Add API for bootstrap and bot_code version (Closed) Base URL: git@github.com:luci/luci-py@master
Patch Set: Make POST Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | appengine/swarming/handlers_endpoints_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_endpoints.py
diff --git a/appengine/swarming/handlers_endpoints.py b/appengine/swarming/handlers_endpoints.py
index 14bffea97035efe1e79a5829c7adbe8ff8301e71..03302a2f6f571d89a570ef1763687c58b093fa94 100644
--- a/appengine/swarming/handlers_endpoints.py
+++ b/appengine/swarming/handlers_endpoints.py
@@ -6,6 +6,7 @@
import datetime
import logging
+import os
from google.appengine.api import datastore_errors
from google.appengine.ext import ndb
@@ -133,7 +134,20 @@ class SwarmingServerService(remote.Service):
@auth.require(acl.is_bot_or_user)
def details(self, _request):
"""Returns information about the server."""
- return swarming_rpcs.ServerDetails(server_version=utils.get_app_version())
+ host = 'https://' + os.environ['HTTP_HOST']
+ return swarming_rpcs.ServerDetails(
+ bot_version = bot_code.get_bot_version(host),
+ server_version = utils.get_app_version())
+
+ @gae_ts_mon.instrument_endpoint()
+ @auth.endpoints_method(
+ message_types.VoidMessage, swarming_rpcs.BootstrapToken)
+ @auth.require(acl.is_bootstrapper)
+ def token(self, _request):
+ """Returns a token to bootstrap a new bot."""
+ return swarming_rpcs.BootstrapToken(
+ bootstrap_token = bot_code.generate_bootstrap_token(),
+ )
@gae_ts_mon.instrument_endpoint()
@auth.endpoints_method(
« no previous file with comments | « no previous file | appengine/swarming/handlers_endpoints_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698