def _on_deregister(self, ch, method, properties, message):
"""
Event method that is called when a de-registration request is received.
Removes the given plugin from the internal data model.
:param properties: request properties
:param message: request body (contains UUID to identify plugin)
:return: response message
"""
message = json.loads(str(message))
try:
p = model.Plugin.objects.get(uuid=message.get("uuid"))
p.delete()
except DoesNotExist:
LOG.debug("Couldn't find plugin with UUID %r in DB" % pid)
LOG.info("DE-REGISTERED: %r" % message.get("uuid"))
# broadcast a plugin status update to the other plugin
self.send_plugin_status_update()
# return result
response = {
"status": "OK"
}
return json.dumps(response)
评论列表
文章目录