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

Make authz tuple deletion idempotent #2201

Merged
merged 1 commit into from
Jan 26, 2024
Merged

Make authz tuple deletion idempotent #2201

merged 1 commit into from
Jan 26, 2024

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Jan 26, 2024

This detect if the error for deleting an object is caused by the tuple
not existing, and if so, it discards the error since that's what we
wanted. Thus making calls to the tuple deletion idempotent.

This detect if the error for deleting an object is caused by the tuple
not existing, and if so, it discards the error since that's what we
wanted. Thus making calls to the tuple deletion idempotent.
@JAORMX JAORMX requested a review from a team as a code owner January 26, 2024 07:56
Copy link
Contributor

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

approved with a question

@@ -255,7 +255,9 @@ func (a *ClientWrapper) Delete(ctx context.Context, user string, role Role, proj
Object: getProjectForTuple(project),
},
}).Execute()
if err != nil {
if err != nil && strings.Contains(err.Error(), "cannot delete a tuple which does not exist") {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume there's no Error we could match using errors.Is ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's right 😢

@JAORMX JAORMX merged commit fc379be into main Jan 26, 2024
18 checks passed
@JAORMX JAORMX deleted the authz-delete-idempotent branch January 26, 2024 08:09
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