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

[v23.2.x] rpk: make mechanism flag required in user update #21511

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/go/rpk/pkg/cli/acl/user/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ func newUpdateCommand(fs afero.Fs, p *config.Params) *cobra.Command {
}

cmd.Flags().StringVar(&newPass, "new-password", "", "New user's password.")
cmd.Flags().StringVar(&mechanism, "mechanism", adminapi.ScramSha256, "SASL mechanism to use for the user you are creating (scram-sha-256, scram-sha-512, case insensitive)")
cmd.Flags().StringVar(&mechanism, "mechanism", adminapi.ScramSha256, "SASL mechanism to use for the user you are updating (scram-sha-256, scram-sha-512, case insensitive)")
cmd.MarkFlagRequired("new-password")
cmd.MarkFlagRequired("mechanism")

return cmd
}
5 changes: 3 additions & 2 deletions tests/rptest/clients/rpk.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,11 @@ def sasl_create_user_basic_mix(self,

return self._run(cmd)

def sasl_update_user(self, user, new_password):
def sasl_update_user(self, user, new_password, new_mechanism):
cmd = [
"acl", "user", "update", user, "--new-password", new_password,
"-X", "admin.hosts=" + self._redpanda.admin_endpoints()
"--mechanism", new_mechanism, "-X",
"admin.hosts=" + self._redpanda.admin_endpoints()
]
return self._run(cmd)

Expand Down
3 changes: 2 additions & 1 deletion tests/rptest/tests/rpk_acl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ def test_create_update(self):
# We check that we can list the topics:
assert topic in topic_list

out = self._rpk.sasl_update_user(self.username, new_password)
out = self._rpk.sasl_update_user(self.username, new_password,
self.mechanism)
assert f'Updated user "{self.username}" successfully' in out

with expect_exception(
Expand Down
Loading