File tree Expand file tree Collapse file tree 2 files changed +22
-6
lines changed
Expand file tree Collapse file tree 2 files changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,12 @@ def load_itbill_subscription(record):
123123 """
124124 Update the subscription record with the latest ITBill data
125125 """
126- record .update_subscription (
127- get_subscription_by_key_remote (record .subscription .key_remote )
128- )
126+ try :
127+ record .update_subscription (
128+ get_subscription_by_key_remote (record .subscription .key_remote )
129+ )
130+ except DataFailureException as ex :
131+ if ex .status == 404 :
132+ raise ITBillSubscriptionNotFound (record .subscription .key_remote )
133+
134+ raise ex
Original file line number Diff line number Diff line change @@ -284,9 +284,19 @@ def load_or_update_subscription(sdr: SharedDriveRecord):
284284 """
285285 # Do we already have an ITBillSubscription on file?
286286 if sdr .subscription is not None :
287- load_itbill_subscription (sdr )
288- sdr .subscription .save ()
289- return sdr .subscription
287+ try :
288+ load_itbill_subscription (sdr )
289+ sdr .subscription .save ()
290+ return sdr .subscription
291+ except ITBillSubscriptionNotFound as ex :
292+ sub = sdr .subscription
293+ if sub .state == ITBillSubscription .SUBSCRIPTION_DEPLOYED :
294+ logger .error (f"Remote key not found in itbill: { ex } "
295+ "for drive in deployed state" )
296+ else :
297+ logger .info ("Remote key not found in itbill for drive "
298+ f"{ ex } in { sub .get_state_display } state." )
299+ return None
290300
291301 # Does an ITBill subscription exist remotely and we just have to get it?
292302 key_remote = sdr .get_itbill_key_remote ()
You can’t perform that action at this time.
0 commit comments