def get_bootstrap(self, request): """Retrieves the current or a previous version of bootstrap.py.""" obj = bot_code.get_bootstrap('', request.version) if not obj: return swarming_rpcs.FileContent() return swarming_rpcs.FileContent( content=obj.content.decode('utf-8'), who=obj.who.to_bytes() if obj.who else None, when=obj.when, version=obj.version)
def get_bot_config(self, _request): """Retrieves the current version of bot_config.py.""" obj = bot_code.get_bot_config() return swarming_rpcs.FileContent(content=obj.content.decode('utf-8'), who=obj.who, when=obj.when, version=obj.version)
def put_bot_config(self, request): """Stores a new version of bot_config.py.""" key = bot_code.store_bot_config(request.content.encode('utf-8')) obj = key.get() return swarming_rpcs.FileContent( who=obj.who.to_bytes() if obj.who else None, when=obj.created_ts, version=obj.version)