Add method to delete and update computes

This commit is contained in:
Julien Duponchelle
2016-05-25 11:27:41 +02:00
parent 2c72452c91
commit dbda3fc8fc
7 changed files with 143 additions and 5 deletions

View File

@ -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