jfrog-cli
jfrog-cli copied to clipboard
jf rt ptu file.json fails with cannot unmarshal array into Go struct
Describe the bug
I'm trying to use the command jf rt ptu file.json. The file.json is a file generated with: curl -H "Authorization: Bearer xyz" https://global-artifacts.xyz.com:/artifactory/api/v2/security/permissions/ZZZ | jq
the response is something like: { "name": "ZZZ", "repo": { "actions": { "users": { "ABCD": [ "read", "annotate", "managedXrayMeta", "write", "delete", "manage" ], } }, "repositories": [ "ZZZ" ], "include-patterns": [ "**" ], "exclude-patterns": [] } ... ... ... }
do you know why is this failing? the json sent is the same one as the one I get with the curl command. If I remove the [] form the exclude patterns and just put "" then the error goes up to the include-patters.
the complete error is: JFROG_CLI_LOG_LEVEL=DEBUG jf rt ptu get2.json 15:27:32 [Debug] JFrog CLI version: 2.55.0 15:27:32 [Debug] OS/Arch: linux/amd64 15:27:32 [Debug] Usage Report: Sending info... 15:27:32 [Debug] Sending HTTP GET request to: https://global-artifacts.xyz.com/artifactory/api/system/version 15:27:32 [Debug] Artifactory response: 200 15:27:32 [Debug] JFrog Artifactory version is: 7.77.5 15:27:32 [Debug] Sending HTTP POST request to: https://global-artifacts.xyz.com/artifactory/api/system/usage 15:27:32 [🚨Error] json: cannot unmarshal array into Go struct field PermissionSectionAnswer.exclude-patterns of type string
Current behavior
the complete error is: JFROG_CLI_LOG_LEVEL=DEBUG jf rt ptu get2.json 15:27:32 [Debug] JFrog CLI version: 2.55.0 15:27:32 [Debug] OS/Arch: linux/amd64 15:27:32 [Debug] Usage Report: Sending info... 15:27:32 [Debug] Sending HTTP GET request to: https://global-artifacts.xyz.com/artifactory/api/system/version 15:27:32 [Debug] Artifactory response: 200 15:27:32 [Debug] JFrog Artifactory version is: 7.77.5 15:27:32 [Debug] Sending HTTP POST request to: https://global-artifacts.xyz.com/artifactory/api/system/usage 15:27:32 [🚨Error] json: cannot unmarshal array into Go struct field PermissionSectionAnswer.exclude-patterns of type string
Reproduction steps
first the json is obtained with a curl command, the output is just copied to a .json file, but when the jf rt ptu command is run the error appears
Expected behavior
The expected behaviour would have been the json to be correct as it is what the curl command returns
JFrog CLI version
2.55.0
Operating system type and version
Ubuntu 22.04.4 LTS
JFrog Artifactory version
JFrog Artifactory version is: 7.77.5
JFrog Xray version
No response
We are getting the same exact error when doing the same steps as well
Hi @davidpr @cjj196 ,
The jf rt ptc
and jf rt ptu
accept a configuration template that should be created by the jf rt ptt
command.
The template is created interactively, and supports variables that can later be replaced by values when creating/updating a permission target (Documentation).
We're sorry if you found this misleading and would appreciate your feedback. Thanks