66from openbrokerapi .catalog import ServicePlan
77from openbrokerapi .errors import ErrInstanceAlreadyExists , ErrAsyncRequired , \
88 ErrBindingAlreadyExists , ErrBadRequest , ErrInstanceDoesNotExist , \
9- ServiceException , ErrBindingDoesNotExist
9+ ServiceException
1010from openbrokerapi .service_broker import ServiceBroker , Service , \
1111 ProvisionDetails , ProvisionedServiceSpec , ProvisionState , GetBindingSpec , \
1212 BindDetails , Binding , BindState , UnbindDetails , UnbindSpec , \
1919 get_addon_updateable , get_addon_bindable , get_addon_allow_params , \
2020 get_addon_archive , get_binding_file , get_instance_file
2121from .database .metadata import load_instance_meta , load_binding_meta , load_addons_meta
22- from .tasks import provision , bind , deprovision , update
22+ from .tasks import provision , bind , deprovision , update , unbind
2323
2424logger = logging .getLogger (__name__ )
2525
@@ -112,10 +112,9 @@ def unbind(self,
112112 async_allowed : bool ,
113113 ** kwargs
114114 ) -> UnbindSpec :
115- binding_file = get_binding_file (instance_id )
116- if os .path .exists (binding_file ):
117- os .remove (binding_file )
118- return UnbindSpec (is_async = False )
115+ logger .debug (f"unbind instance { instance_id } " )
116+ unbind .delay (instance_id )
117+ return UnbindSpec (is_async = True )
119118
120119 def update (self ,
121120 instance_id : str ,
@@ -179,7 +178,7 @@ def last_operation(self,
179178 OperationState (data ["last_operation" ]["state" ]),
180179 data ["last_operation" ]["description" ]
181180 )
182- raise ErrInstanceDoesNotExist ( )
181+ raise LastOperation ( OperationState . IN_PROGRESS )
183182
184183 def last_binding_operation (self ,
185184 instance_id : str ,
@@ -193,4 +192,4 @@ def last_binding_operation(self,
193192 OperationState (data ["last_operation" ]["state" ]),
194193 data ["last_operation" ]["description" ]
195194 )
196- raise ErrBindingDoesNotExist ( )
195+ return LastOperation ( OperationState . SUCCEEDED )
0 commit comments