File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,6 +160,25 @@ async def attach_storage(self, storage_ids=[]):
160160 unit_tag = self .tag ,
161161 ) for s_id in storage_ids ])
162162
163+ async def detach_storage (self , force = False , * storage_ids ):
164+ """Detaches storage from units.
165+
166+ :param bool force: Forcefully detach storage
167+ :param [str] storage_ids:
168+ :return:
169+ """
170+ if not storage_ids :
171+ raise JujuError ("Expected at least one storage ID" )
172+
173+ storage_facade = client .StorageFacade .from_connection (self .connection )
174+ return await storage_facade .DetachStorage (
175+ force = force ,
176+ ids = [client .StorageAttachmentIds (ids = [client .StorageAttachmentId (
177+ storage_tag = tag .storage (s ),
178+ unit_tag = self .tag ,
179+ ) for s in storage_ids ])]
180+ )
181+
163182 async def run (self , command , timeout = None ):
164183 """Run command on this unit.
165184
You can’t perform that action at this time.
0 commit comments