Skip to content

Commit

Permalink
fix: remove omitnotfound (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov authored May 13, 2024
1 parent c0705ab commit 4b17d24
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controllers/serviceintegration_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (h ServiceIntegrationHandler) delete(ctx context.Context, avn *aiven.Client
}

err = avnGen.ServiceIntegrationDelete(ctx, si.Spec.Project, si.Status.ID)
if avngen.OmitNotFound(err) != nil {
if err != nil && !isNotFound(err) {
return false, fmt.Errorf("aiven client delete service integration error: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion controllers/serviceintegrationendpoint_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (h ServiceIntegrationEndpointHandler) delete(ctx context.Context, avn *aive
}

err = avnGen.ServiceIntegrationEndpointDelete(ctx, si.Spec.Project, si.Status.ID)
if avngen.OmitNotFound(err) != nil {
if err != nil && !isNotFound(err) {
return false, fmt.Errorf("aiven client delete service integration endpoint error: %w", err)
}

Expand Down
3 changes: 2 additions & 1 deletion sweeper/service_integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func (sweeper *serviceIntegrationEndpointsSweeper) Sweep(ctx context.Context, pr
}

for _, s := range endpoints {
if err := sweeper.client.ServiceIntegrationEndpointDelete(ctx, projectName, s.EndpointId); avngen.OmitNotFound(err) != nil {
err := sweeper.client.ServiceIntegrationEndpointDelete(ctx, projectName, s.EndpointId)
if err != nil && !avngen.IsNotFound(err) {
return fmt.Errorf("error deleting service integration endpoint %q: %w", s.EndpointName, err)
}
}
Expand Down
3 changes: 2 additions & 1 deletion sweeper/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ func (sweeper *servicesSweeper) Sweep(ctx context.Context, projectName string) e
}
}

if err := sweeper.client.ServiceDelete(ctx, projectName, s.ServiceName); avngen.OmitNotFound(err) != nil {
err := sweeper.client.ServiceDelete(ctx, projectName, s.ServiceName)
if err != nil && !avngen.IsNotFound(err) {
return fmt.Errorf("error deleting service %s: %w", s.ServiceName, err)
}
}
Expand Down

0 comments on commit 4b17d24

Please sign in to comment.