The server has now 2 notification streams

* A new one for controller related events (compute, appliance templates etc.)
* The existing one for project related events (links, nodes etc.)
This commit is contained in:
grossmj committed 2018-08-16 21:31:57 +07:00
1 parent dac3ba19b7
commit 7f72b90b0e
364 files changed
+12364 -9923

No files matched your search

+3 -3
View File
@@ -407,7 +407,7 @@ class Node:
yield from self.parse_node_response(response.json)
elif old_json != self.__json__():
# We send notif only if object has changed
self.project.controller.notification.emit("node.updated", self.__json__())
self.project.controller.notification.project_emit("node.updated", self.__json__())
self.project.dump()
@asyncio.coroutine
@@ -575,13 +575,13 @@ class Node:
for directory in images_directories(type):
image = os.path.join(directory, img)
if os.path.exists(image):
self.project.controller.notification.emit("log.info", {"message": "Uploading missing image {}".format(img)})
self.project.controller.notification.project_emit("log.info", {"message": "Uploading missing image {}".format(img)})
try:
with open(image, 'rb') as f:
yield from self._compute.post("/{}/images/{}".format(self._node_type, os.path.basename(img)), data=f, timeout=None)
except OSError as e:
raise aiohttp.web.HTTPConflict(text="Can't upload {}: {}".format(image, str(e)))
self.project.controller.notification.emit("log.info", {"message": "Upload finished for {}".format(img)})
self.project.controller.notification.project_emit("log.info", {"message": "Upload finished for {}".format(img)})
return True
return False