File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,14 +22,16 @@ async def destroy(self, force=False):
2222 Blocks until the machine is actually removed.
2323
2424 """
25- facade = client .MachineManagerFacade .from_connection (self .connection )
26-
27- log .debug (
28- 'Destroying machine %s' , self .id )
25+ if client .MachineManagerFacade .best_facade_version (self .connection ) <= 6 :
26+ # Then we'll use the DestroyMachines from client.ClientFacade
27+ facade = client .ClientFacade .from_connection (self .connection )
28+ await facade .DestroyMachines (force = force , machine_names = [self .id ])
29+ else :
30+ facade = client .MachineManagerFacade .from_connection (self .connection )
31+ await facade .DestroyMachineWithParams (force = force , machine_tags = [tag .machine (self .id )])
2932
30- await facade .DestroyMachineWithParams (force = force , machine_tags = [tag .machine (self .id )])
31- return await self .model ._wait (
32- 'machine' , self .id , 'remove' )
33+ log .debug ('Destroying machine %s' , self .id )
34+ return await self .model ._wait ('machine' , self .id , 'remove' )
3335 remove = destroy
3436
3537 async def get_annotations (self ):
You can’t perform that action at this time.
0 commit comments