mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Add method to delete and update computes
This commit is contained in:
7 files changed
+143
-5
No files matched your search
@@ -117,6 +117,16 @@ class Controller:
|
||||
self.notification.emit("compute.updated", self._computes[compute_id].__json__())
|
||||
return self._computes[compute_id]
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete_compute(self, compute_id):
|
||||
"""
|
||||
Delete a compute node
|
||||
:param compute_id: Compute server identifier
|
||||
"""
|
||||
compute = self.get_compute(compute_id)
|
||||
del self._computes[compute_id]
|
||||
self.notification.emit("compute.deleted", compute.__json__())
|
||||
|
||||
@property
|
||||
def notification(self):
|
||||
"""
|
||||
|
||||
@@ -42,9 +42,9 @@ class Compute:
|
||||
assert controller is not None
|
||||
log.info("Create compute %s", compute_id)
|
||||
self._id = compute_id
|
||||
self._protocol = protocol
|
||||
self._host = host
|
||||
self._port = port
|
||||
self.protocol = protocol
|
||||
self.host = host
|
||||
self.port = port
|
||||
self._user = None
|
||||
self._password = None
|
||||
self._connected = False
|
||||
@@ -73,6 +73,15 @@ class Compute:
|
||||
else:
|
||||
self._auth = None
|
||||
|
||||
@asyncio.coroutine
|
||||
def update(self, **kwargs):
|
||||
for kw in kwargs:
|
||||
setattr(self, kw, kwargs[kw])
|
||||
if self._session:
|
||||
self._session.close()
|
||||
self._connected = False
|
||||
self._controller.notification.emit("compute.updated", self.__json__())
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
"""
|
||||
@@ -117,6 +126,10 @@ class Compute:
|
||||
"""
|
||||
return self._host
|
||||
|
||||
@host.setter
|
||||
def host(self, host):
|
||||
self._host = host
|
||||
|
||||
@property
|
||||
def port(self):
|
||||
"""
|
||||
@@ -124,6 +137,10 @@ class Compute:
|
||||
"""
|
||||
return self._port
|
||||
|
||||
@port.setter
|
||||
def port(self, port):
|
||||
self._port = port
|
||||
|
||||
@property
|
||||
def protocol(self):
|
||||
"""
|
||||
@@ -131,6 +148,10 @@ class Compute:
|
||||
"""
|
||||
return self._protocol
|
||||
|
||||
@protocol.setter
|
||||
def protocol(self, protocol):
|
||||
self._protocol = protocol
|
||||
|
||||
@property
|
||||
def user(self):
|
||||
return self._user
|
||||
|
||||
Reference in new issue
Block a user