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

Unified Diff: appengine/swarming/handlers_bot.py

Issue 1778083002: Enforce users to specify a 'pool' dimension when triggering a task. (Closed) Base URL: git@github.com:luci/luci-py.git@master
Patch Set: Created 4 years, 9 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/server/task_request.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/swarming/handlers_bot.py
diff --git a/appengine/swarming/handlers_bot.py b/appengine/swarming/handlers_bot.py
index ca8259e7f5050dd8bb504240e3575a92e536d56d..ba3dfd7b8134219794722a7f6cbf68b032cbf3d0 100644
--- a/appengine/swarming/handlers_bot.py
+++ b/appengine/swarming/handlers_bot.py
@@ -156,8 +156,8 @@ class _BotBaseHandler(auth.ApiHandler):
request = self.parse_body()
version = request.get('version', None)
- dimensions = request.get('dimensions', {})
- state = request.get('state', {})
+ dimensions = request.get('dimensions') or {}
+ state = request.get('state') or {}
bot_id = None
if dimensions.get('id'):
dimension_id = dimensions['id']
@@ -189,6 +189,9 @@ class _BotBaseHandler(auth.ApiHandler):
if not bot_id:
quarantined_msg = 'Missing bot id'
break
+ if not dimensions.get('pool'):
+ quarantined_msg = 'Missing \'pool\' dimension'
+ break
if not all(
isinstance(key, unicode) and
« no previous file with comments | « no previous file | appengine/swarming/server/task_request.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698