-
Notifications
You must be signed in to change notification settings - Fork 0
CSTACKEX-158: if ontap snapshot are already delete from ontap side, d… #82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -239,4 +239,23 @@ public static String extractUuidFromOntapJobDescription(String description, Stri | |
| return remainder.isEmpty() ? null : remainder; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true when the exception indicates the ONTAP snapshot was already removed. | ||
| * Delete workflows treat a missing backend snapshot as idempotent success. | ||
| */ | ||
| public static boolean isOntapSnapshotNotFoundError(Throwable error) { | ||
| if (error == null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree, we can also use the same method for other ontap entities like igroup, export policy, volume etc |
||
| return false; | ||
| } | ||
| String message = error.getMessage(); | ||
| if (message != null) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if message is null somehow, I think func run infinitely ? |
||
| String lower = message.toLowerCase(); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is better to check the status code as 404 |
||
| if (lower.contains("404") || lower.contains("not found") || lower.contains("does not exist") | ||
| || lower.contains("entry doesn't exist")) { | ||
| return true; | ||
| } | ||
| } | ||
| return isOntapSnapshotNotFoundError(error.getCause()); | ||
| } | ||
|
rajiv-jain-netapp marked this conversation as resolved.
|
||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the idea is to throw a polished message back to the user, wouldn't it be better to have a generic ONTAP Exception wrapper class and have similar implementations for all possible ONTAP error codes?