async def destroy(self, force=False):
"""Remove this machine from the model.
+ Blocks until the machine is actually removed.
+
"""
facade = client.ClientFacade()
facade.connect(self.connection)
log.debug(
'Destroying machine %s', self.id)
- return await facade.DestroyMachines(force, [self.id])
+ await facade.DestroyMachines(force, [self.id])
+ return await self.model._wait(
+ 'machine', self.id, 'remove')
remove = destroy
def run(self, command, timeout=None):
"""
pass
+ async def set_annotations(self, annotations):
+ """Set annotations on this machine.
+
+ :param annotations map[string]string: the annotations as key/value
+ pairs.
+
+ """
+ log.debug('Updating annotations on machine %s', self.id)
+
+ self.ann_facade = client.AnnotationsFacade()
+ self.ann_facade.connect(self.connection)
+
+ ann = client.EntityAnnotations(
+ entity=self.id,
+ annotations=annotations,
+ )
+ return await self.ann_facade.Set([ann])
+
def scp(
self, source_path, user=None, destination_path=None, proxy=False,
scp_opts=None):