Skip to content

Commit 15cf66f

Browse files
Maxrovrravinitp
authored andcommitted
Added - fix for unsuccessful delete removing resource from state when circuit breaker is open
1 parent f9544c5 commit 15cf66f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

internal/tfresource/errors.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ func (tfE customError) Error() error {
184184

185185
func handleMissingResourceError(sync ResourceVoider, err *error) {
186186

187+
if isCircuitBreakerOpen(*err) {
188+
log.Printf("[DEBUG] the circuit breaker is in the open state, error triggering the circuit breaker is \n %s\n", *err)
189+
return
190+
}
191+
187192
if err != nil {
188193
// patch till OCE service returns correct error response code for invalid auth token
189194
if strings.Contains((*err).Error(), "IDCS token validation has failed") {
@@ -198,7 +203,9 @@ func handleMissingResourceError(sync ResourceVoider, err *error) {
198203
log.Println("[DEBUG] Object does not exist, voiding resource and nullifying error")
199204
if sync != nil {
200205
sync.VoidState()
206+
log.Println("[DEBUG] the response contains an error, but ignoring it and voiding state")
201207
}
208+
log.Printf("[DEBUG] the ignored error is\n %s\n", *err)
202209
*err = nil
203210
}
204211
}
@@ -309,3 +316,7 @@ func getVersionAndDateErrorImpl(version string, date string) string {
309316
}
310317
return result
311318
}
319+
320+
func isCircuitBreakerOpen(err error) bool {
321+
return oci_common.IsCircuitBreakerError(err)
322+
}

0 commit comments

Comments
 (0)