Skip to content

Commit 367ddc6

Browse files
committed
Add remove_storage
1 parent 7f099ab commit 367ddc6

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

juju/model.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,24 @@ async def create_storage_pool(self, name, provider_type, attributes=""):
907907
attrs=dict(_attrs)
908908
)])
909909

910+
async def remove_storage(self, force=False, destroy_storage=False, *storage_ids):
911+
"""Removes storage from the model.
912+
913+
:param force: Remove storage even if it is currently attached
914+
:param destroy_storage: Remove the storage and destroy it
915+
:param storage_ids:
916+
:return:
917+
"""
918+
if not storage_ids:
919+
raise JujuError("Expected at least one storage ID")
920+
921+
storage_facade = client.StorageFacade.from_connection(self.connection)
922+
return await storage_facade.Remove(storage=[client.RemoveStorageInstance(
923+
destroy_storage=destroy_storage,
924+
force=False,
925+
tag=tag.storage(s)
926+
) for s in storage_ids])
927+
910928
async def remove_application(self, app_name, block_until_done=False):
911929
"""Removes the given application from the model.
912930

0 commit comments

Comments
 (0)