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

Unified Diff: appengine/swarming/swarming_bot/bot_code/bot_main.py

Issue 2689483004: swarming: Add server-side implementation for supplemental bot_config (Closed)
Patch Set: Bot side fix Created 3 years, 10 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
Index: appengine/swarming/swarming_bot/bot_code/bot_main.py
diff --git a/appengine/swarming/swarming_bot/bot_code/bot_main.py b/appengine/swarming/swarming_bot/bot_code/bot_main.py
index 2c3539ad3442c57fd02cb80df98c9872157082f5..3e37b25918e7cfbfef8f75e947466694b76dfe97 100644
--- a/appengine/swarming/swarming_bot/bot_code/bot_main.py
+++ b/appengine/swarming/swarming_bot/bot_code/bot_main.py
@@ -140,6 +140,10 @@ def _register_extra_bot_config(content):
This file is called implicitly by _call_hook() and _call_hook_safe().
"""
global _EXTRA_BOT_CONFIG
+ if isinstance(content, unicode):
+ # compile will throw if there's a '# coding: utf-8' line and the string is
+ # in unicode. <3 python.
+ content = content.encode('utf-8')
try:
compiled = compile(content, 'bot_config.py', 'exec')
_EXTRA_BOT_CONFIG = types.ModuleType('bot_config')

Powered by Google App Engine
This is Rietveld 408576698