mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Send event when adding compute node or modify it (for server sumary)
This commit is contained in:
5 files changed
+29
-14
No files matched your search
@@ -93,15 +93,21 @@ class Controller:
|
||||
:param compute_id: Compute server identifier
|
||||
:param kwargs: See the documentation of Compute
|
||||
"""
|
||||
|
||||
# We disallow to create from the outside the
|
||||
if compute_id == 'local':
|
||||
return self._create_local_compute()
|
||||
|
||||
if compute_id not in self._computes:
|
||||
|
||||
|
||||
# We disallow to create from the outside the
|
||||
if compute_id == 'local':
|
||||
compute_server = self._create_local_compute()
|
||||
self.notification.emit("compute.created", compute_server.__json__())
|
||||
return compute_server
|
||||
|
||||
compute_server = Compute(compute_id=compute_id, controller=self, **kwargs)
|
||||
self._computes[compute_id] = compute_server
|
||||
self.save()
|
||||
self.notification.emit("compute.created", compute_server.__json__())
|
||||
else:
|
||||
self.notification.emit("compute.updated", self._computes[compute_id].__json__())
|
||||
return self._computes[compute_id]
|
||||
|
||||
def _create_local_compute(self):
|
||||
|
||||
@@ -92,7 +92,7 @@ class Compute:
|
||||
if name is not None:
|
||||
self._name = name
|
||||
elif self._id == "local":
|
||||
self._name = "local"
|
||||
self._name = "Local"
|
||||
else:
|
||||
self._name = "{}://{}:{}".format(self._protocol, self._host, self._port)
|
||||
|
||||
@@ -199,6 +199,7 @@ class Compute:
|
||||
|
||||
self._notifications = asyncio.async(self._connect_notification())
|
||||
self._connected = True
|
||||
self._controller.notification.emit("compute.updated", self.__json__())
|
||||
|
||||
@asyncio.coroutine
|
||||
def _connect_notification(self):
|
||||
|
||||
Reference in new issue
Block a user