-
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
Rename agent_master
ACL token in the API and CLI
#11669
Conversation
c8f3fb3
to
4456ee7
Compare
cfcf6bc
to
73aab89
Compare
9c2bc3c
to
2d10e0d
Compare
73aab89
to
7b7db29
Compare
7b7db29
to
5984b76
Compare
9e8ddb3
to
9617729
Compare
9617729
to
44d8abd
Compare
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 working on this @boxofrad!!
I added few comments about master
mention in tests and deprecation notice.
@@ -5308,14 +5308,23 @@ func TestAgent_Token(t *testing.T) { | |||
effective: tokens{master: "M"}, | |||
}, | |||
{ | |||
name: "set master ", | |||
name: "set master", |
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.
While we are at it we should change this too, I see a lot of other references that can be changed in the test file
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.
I believe the plan is to only focus on external references for now. We can cleanup all the internal stuff after the 1.11 release.
But I think in this particular case we would keep it, because it's testing the old name.
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.
Yep, exactly that 👍🏻
I have a WIP branch that renames the struct fields etc. but in this case, we'd leave the test name the same.
@@ -1444,7 +1444,7 @@ func (s *HTTPHandlers) AgentToken(resp http.ResponseWriter, req *http.Request) ( | |||
triggerAntiEntropySync = true | |||
} | |||
|
|||
case "acl_agent_master_token", "agent_master": | |||
case "acl_agent_master_token", "agent_master", "agent_recovery": |
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.
Is the plan to deprecate the acl_agent_master_token
and agent_master
naming in favour of agent_recovery
? If so I don't see any deprecation notice for it in the doc.
It also would be nice to have those defined as const and have a deprecation notice for the ones we want to remove in the future.
What you think about that?
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.
Yeah. It's not super obvious from the diff, but the target
we're switching on is a path suffix - so there's a deprecation notice in the API docs here 🙂
I'd be happy to move them into constants, but as they're only really used in this handler, I wonder if the indirection would be worth it, or make the code less clear?
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.
Nice!
One comment about the API client library logic maybe not handling errors correctly.
meta, status, err := a.updateTokenOnce(target, token, q) | ||
if err != nil && status == 404 { | ||
meta, _, err = a.updateTokenOnce(fallback, token, q) | ||
func (a *Agent) updateTokenFallback(token string, q *WriteOptions, targets ...string) (*WriteMeta, 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.
varargs, nice! 🎉
Co-authored-by: Daniel Nephin <[email protected]>
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!
🍒 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/513279. |
Following on from #11665, this PR renames the agent master token in the API and CLI.