-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
acl: acl replication routine to report the last error message #10612
Conversation
acl_endpoint_test.go:507: Error Trace: acl_endpoint_test.go:507 retry.go:148 retry.go:149 retry.go:103 acl_endpoint_test.go:504 Error: Received unexpected error: codec.decoder: decodeValue: Cannot decode non-nil codec value into nil error (1 methods) Test: TestACLEndpoint_ReplicationStatus
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.
Thank you for the PR! This looks really good. I left a couple comments below for a couple small improvements.
It would also be great to include a changelog entry. A changelog entry can be added in a file named .changelog/10612.txt
(named using the PR number). You can see some other examples in that directory for the exact syntax to use.
agent/consul/acl_replication.go
Outdated
@@ -484,11 +484,12 @@ func (s *Server) IsACLReplicationEnabled() bool { | |||
s.config.ACLTokenReplication | |||
} | |||
|
|||
func (s *Server) updateACLReplicationStatusError() { | |||
func (s *Server) updateACLReplicationStatusError(errorMsg error) { |
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.
Since we are already doing a err != nil
check in the caller, we were thinking it would be safer to accept a string here instead of an error. That way no new callers can accidentally pass a nil
error.
func (s *Server) updateACLReplicationStatusError(errorMsg error) { | |
func (s *Server) updateACLReplicationStatusError(errorMsg string) { |
which I guess will requires a change to the line below that uses errorMsg
.
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.
Done.
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.
LGTM, thank you!
🍒 If backport labels were added before merging, cherry-picking will start automatically. To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/423688. |
This PR adds the new field
LastErrorMessage
to theACLReplicationStatus
endpoint. Whenever the Goroutine executing therunACLReplicator
encounters an error, bothLastError
andLastErrorMessage
field in the endpoint are updated.Test
TestACLReplication_TokensRedacted
is updated to check also theLastErrorMessage
field.Fixes #10521.