Closed jabbrwcky closed 1 year ago
Nice, could you git commit -s
? See https://github.com/crossplane-contrib/provider-sql/pull/118/checks?check_run_id=9415901160
Just a heads up: I also think we will need a rebase when https://github.com/crossplane-contrib/provider-sql/pull/105 is merged
Commit is signed
Can you fix the lint error?
Fixed the reported linter issues.
You might consider upgrading golangci-lint (if possible for github-actions?), the output from v 1.50.1 is much more helpful:
pkg/controller/mysql/grant/reconciler.go:333:4: commentFormatting: put a space between `//` and comment text (gocritic)
//MySQL automatically deletes related grants if the user has been deleted
If the grant is already gone when the reconciler tries to revoke it, it should mark the resource as successfully removed, not error.
MySQL 8.x+ supports
REVOKE %s IF EXISTS ON %s.%s FROM %s@%s IGNORE UNKNOWN USER
to avoid an error (which would be a cleaner solution IMO), but this will only be possible when dropping support for earlier versions.Description of your changes
Checks the actual mysql error code that is returned when the grant revocation SQL errors; if the code states that the grant does not exist, it returns
nil
for successful removal of the grant.Basically uses the same code as https://github.com/crossplane-contrib/provider-sql/blob/ed6c55ce4798967e7652a4cce9f844b99ac1bbb7/pkg/controller/mysql/grant/reconciler.go#L227-L231
Fixes #47
I have:
make reviewable
to ensure this PR is ready for review.How has this code been tested
Added unit test for this case to
grants/reconciler_test.go