Skip to content

Commit 920debc

Browse files
authored
Merge pull request #445 from davigar15/master
#445 This commit exposes the force and the max_wait options when destroying the model.
2 parents 701cb94 + 82d49aa commit 920debc

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

juju/client/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
'MigrationTarget': {'versions': [1]},
8181
'ModelConfig': {'versions': [1, 2]},
8282
'ModelGeneration': {'versions': [1, 2]},
83-
'ModelManager': {'versions': [2, 3, 4]},
83+
'ModelManager': {'versions': [2, 3, 4, 5]},
8484
'ModelUpgrader': {'versions': [1]},
8585
'Payloads': {'versions': [1]},
8686
'PayloadsHookContext': {'versions': [1]},

juju/controller.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,12 +367,15 @@ async def add_model(
367367

368368
return model
369369

370-
async def destroy_models(self, *models, destroy_storage=False):
370+
async def destroy_models(self, *models, destroy_storage=False, force=False, max_wait=None):
371371
"""Destroy one or more models.
372372
373373
:param str *models: Names or UUIDs of models to destroy
374374
:param bool destroy_storage: Whether or not to destroy storage when
375375
destroying the models. Defaults to false.
376+
:param bool force: Whether or not to force when destroying the models.
377+
Defaults to false.
378+
:param int max_wait : Max time in seconds to wait when destroying the models.
376379
377380
"""
378381
uuids = await self.model_uuids()
@@ -390,13 +393,18 @@ async def destroy_models(self, *models, destroy_storage=False):
390393

391394
if model_facade.version >= 5:
392395
params = [
393-
client.DestroyModelParams(model_tag=tag.model(model),
394-
destroy_storage=destroy_storage)
396+
client.DestroyModelParams(
397+
model_tag=tag.model(model),
398+
destroy_storage=destroy_storage,
399+
force=force,
400+
max_wait=max_wait,
401+
)
395402
for model in models]
403+
await model_facade.DestroyModels(models=params)
396404
else:
397405
params = [client.Entity(tag.model(model)) for model in models]
398406

399-
await model_facade.DestroyModels(entities=params)
407+
await model_facade.DestroyModels(entities=params)
400408
destroy_model = destroy_models
401409

402410
async def add_user(self, username, password=None, display_name=None):

0 commit comments

Comments
 (0)