Skip to content

Commit

Permalink
rpk: add err message of CreateACL response
Browse files Browse the repository at this point in the history
Response of CreateACL contains an ErrMessage field
that can provide more information about unknown
failures.
  • Loading branch information
r-vasquez committed Nov 26, 2024
1 parent 26d696e commit ffbd1d3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/go/rpk/pkg/cli/security/acl/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ Allow write permissions to user buzz to transactional ID "txn":
tw := out.NewTable(headersWithError...)
defer tw.Flush()
for _, c := range results {
errMsg := kafka.ErrMessage(c.Err)
if c.ErrMessage != "" {
errMsg = fmt.Sprintf("%v: %v", errMsg, c.ErrMessage)
}
tw.PrintStructFields(aclWithMessage{
c.Principal,
c.Host,
Expand All @@ -77,7 +81,7 @@ Allow write permissions to user buzz to transactional ID "txn":
c.Pattern,
c.Operation,
c.Permission,
kafka.ErrMessage(c.Err),
errMsg,
})
}
},
Expand Down
3 changes: 2 additions & 1 deletion tests/rptest/tests/acls_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ def test_invalid_acl_topic_name(self):

acl = [acl for acl in acls if acl.resource_name == resource]
assert len(acl) == 1, f'Expected match for {resource} not found'
assert acl[0].error == 'INVALID_REQUEST'
assert 'INVALID_REQUEST' in acl[
0].error, f'expected INVALID_REQUEST to be in {acl[0].error}'

'''
The old config style has use_sasl at the top level, which enables
Expand Down

0 comments on commit ffbd1d3

Please sign in to comment.