def put(self, plugin_uuid=None):
LOG.debug("PUT plugin lifecycle: %r" % plugin_uuid)
try:
p = model.Plugin.objects.get(uuid=plugin_uuid)
# get target state from request body
ts = json.loads(request.json).get("target_state")
if ts is None:
LOG.error("Malformed request: %r" % request.json)
return {"message": "malformed request"}, 500
if ts == "start":
PM.send_start_notification(p)
elif ts == "pause":
PM.send_pause_notification(p)
elif ts == "stop":
PM.send_stop_notification(p)
else:
return {"message": "Malformed request"}, 500
return {}, 200
except DoesNotExist as e:
LOG.error("Lookup error: %r" % plugin_uuid)
return {}, 404
# reference to plugin manager
评论列表
文章目录