Skip to content
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

WOR-1777 Handle more instances of ManagementExceptions when deleting resources #1777

Merged
merged 6 commits into from
Jul 23, 2024

Conversation

blakery
Copy link
Contributor

@blakery blakery commented Jul 19, 2024

https://broadworkbench.atlassian.net/browse/WOR-1777

  • change GetAzureDiskAttachedVmStep to extend DeleteAzureControlledResourceStep for management exception handling
    The output of GetAzureDiskAttachedVmStep is only used by DetachAzureDiskFromVmStep, which is already set up to handle a missing value.
  • change DetachAzureDiskFromVmStep to extend DeleteAzureControlledResourceStep
  • Parameterize DeleteAzureControlledResourceStep, for better/more central logging options: There was only one step that didn't already have a parameter named resource, of the appropriate type, and that was trivial to add.
  • Added LandingZoneNotFoundException to common error handling

Because this is changing the parameters of the FlightMap, it could cause a running flight to log a NullPointerException instead of the appropriate exception, if it failed for one of the covered exceptions when running DeleteFederatedCredentialStep.

@blakery blakery changed the title WOR-1777 change steps to extend DeleteAzureControlledResourceStep WOR-1777 Handle more instances of ManagementExceptions when deleting resources Jul 22, 2024
@blakery blakery marked this pull request as ready for review July 22, 2024 15:15
@blakery blakery requested a review from a team as a code owner July 22, 2024 15:15
@blakery blakery requested review from marctalbott and aherbst-broad and removed request for a team July 22, 2024 15:15
*/
public class GetAzureDiskAttachedVmStep implements DeleteControlledResourceStep {
public class GetAzureDiskAttachedVmStep
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a better suggestion unfortunately, but just calling out that I find it rather confusing that this step is a Get step that also extends DeleteAzureControlledResourceStep and it has a deleteResource method that doesn't delete anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know. Naming things is hard.
There is a fairly extensive explanation in the comments, for this reason.

if (e instanceof LandingZoneNotFoundException) {
// If the landing zone is not present, it's probably because it was removed directly
logger.debug(
"Unable to delete resource {} from workspace {}, because no landing zone was found in LZS",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: note in the log msg that we are explicitly ignoring the error and moving on.

.findFirst());
if (code.isPresent()) {
logger.debug(
"LZS encountered management exception {} when deleting resource {} from workspace {}",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: note in the log msg that we are explicitly ignoring the exception and moving on.

@blakery blakery enabled auto-merge (squash) July 23, 2024 13:48
Copy link

sonarcloud bot commented Jul 23, 2024

@blakery blakery merged commit 6beab29 into main Jul 23, 2024
20 checks passed
@blakery blakery deleted the WOR-1777 branch July 23, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants