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

Side by Side Diff: appengine/swarming/handlers_bot.py

Issue 2969513002: Add a default Isolate gRPC proxy in config (Closed)
Patch Set: Add a default Isolate gRPC proxy in config Created 3 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | appengine/swarming/proto/config.proto » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The LUCI Authors. All rights reserved. 1 # Copyright 2015 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Internal bot API handlers.""" 5 """Internal bot API handlers."""
6 6
7 import base64 7 import base64
8 import json 8 import json
9 import logging 9 import logging
10 10
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 Do not warn about unexpected keys. 86 Do not warn about unexpected keys.
87 """ 87 """
88 actual_keys = frozenset(actual_keys) 88 actual_keys = frozenset(actual_keys)
89 missing = minimum_keys - actual_keys 89 missing = minimum_keys - actual_keys
90 if missing: 90 if missing:
91 msg_missing = (' missing: %s' % sorted(missing)) if missing else '' 91 msg_missing = (' missing: %s' % sorted(missing)) if missing else ''
92 return 'Unexpected %s%s; did you make a typo?' % (name, msg_missing) 92 return 'Unexpected %s%s; did you make a typo?' % (name, msg_missing)
93 93
94 94
95 def get_bot_contact_server(request): 95 def get_bot_contact_server(request):
Vadim Sh. 2017/06/29 21:56:23 can we remove this function now?
aludwin 2017/06/29 23:38:57 Done.
96 """Gets the server contacted by the bot. 96 """Gets the server contacted by the bot."""
97 97 return request.host_url
98 Usually, this is the URL of the Swarming server itself, but if the bot
99 is communicating to the server by a gRPC intermediary, this will be the
100 IP address of the gRPC endpoint. The Native API will have an http or
101 https protocol, while gRPC endpoints will have a fake "grpc://" protocol.
102 This is to help consumers of this information (mainly the bot code
103 generators) distinguish between native and gRPC bots.
104 """
105 server = request.host_url
106 if 'luci-grpc' in request.headers:
107 server = 'grpc://%s' % request.headers['luci-grpc']
108 return server
109 98
110 99
111 class _BotApiHandler(auth.ApiHandler): 100 class _BotApiHandler(auth.ApiHandler):
112 """Like ApiHandler, but also implements machine authentication.""" 101 """Like ApiHandler, but also implements machine authentication."""
113 102
114 # Bots are passing credentials through special headers (not cookies), no need 103 # Bots are passing credentials through special headers (not cookies), no need
115 # for XSRF tokens. 104 # for XSRF tokens.
116 xsrf_token_enforce_on = () 105 xsrf_token_enforce_on = ()
117 106
118 @classmethod 107 @classmethod
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 ('/swarming/api/v1/bot/poll', BotPollHandler), 1058 ('/swarming/api/v1/bot/poll', BotPollHandler),
1070 ('/swarming/api/v1/bot/server_ping', ServerPingHandler), 1059 ('/swarming/api/v1/bot/server_ping', ServerPingHandler),
1071 ('/swarming/api/v1/bot/task_update', BotTaskUpdateHandler), 1060 ('/swarming/api/v1/bot/task_update', BotTaskUpdateHandler),
1072 ('/swarming/api/v1/bot/task_update/<task_id:[a-f0-9]+>', 1061 ('/swarming/api/v1/bot/task_update/<task_id:[a-f0-9]+>',
1073 BotTaskUpdateHandler), 1062 BotTaskUpdateHandler),
1074 ('/swarming/api/v1/bot/task_error', BotTaskErrorHandler), 1063 ('/swarming/api/v1/bot/task_error', BotTaskErrorHandler),
1075 ('/swarming/api/v1/bot/task_error/<task_id:[a-f0-9]+>', 1064 ('/swarming/api/v1/bot/task_error/<task_id:[a-f0-9]+>',
1076 BotTaskErrorHandler), 1065 BotTaskErrorHandler),
1077 ] 1066 ]
1078 return [webapp2.Route(*i) for i in routes] 1067 return [webapp2.Route(*i) for i in routes]
OLDNEW
« no previous file with comments | « no previous file | appengine/swarming/proto/config.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698