@@ -217,16 +217,31 @@ async def destroy_unit(self, *unit_names):
217217 return await self .model .destroy_units (* unit_names )
218218 destroy_units = destroy_unit
219219
220- async def destroy (self ):
220+ async def destroy (self , destroy_storage = False , force = False , no_wait = False ):
221221 """Remove this application from the model.
222222
223+ :param bool destroy_storage: Destroy storage attached to application unit. (=false)
224+ :param bool force: Completely remove an application and all its dependencies. (=false)
225+ :param bool no_wait: Rush through application removal without waiting for each individual step to complete (=false)
226+ :param bool block: Blocks until the application is removed from the model
223227 """
228+
229+ if no_wait and not force :
230+ log .warning ("Invalid parameters. Automatically setting the --force parameter to True." )
231+ force = True
232+
224233 app_facade = self ._facade ()
225234
226- log .debug (
227- 'Destroying %s' , self .name )
235+ log .debug ('Destroying {} with parameters -- destroy-storage : {} -- force : {} -- no-wait : {}' . format (
236+ self .name , destroy_storage , force , no_wait ) )
228237
229- return await app_facade .Destroy (application = self .name )
238+ res = await app_facade .DestroyApplication (applications = [client .DestroyApplicationParams (
239+ application_tag = self .tag ,
240+ destroy_storage = destroy_storage ,
241+ force = force ,
242+ max_wait = 0 if no_wait else None ,
243+ )])
244+ return res
230245 remove = destroy
231246
232247 def supports_granular_expose_parameters (self ):
0 commit comments