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

jf rt ptu file.json fails with cannot unmarshal array into Go struct #2511

Closed
davidpr opened this issue Apr 2, 2024 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@davidpr
Copy link

davidpr commented Apr 2, 2024

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

@davidpr davidpr added the bug Something isn't working label Apr 2, 2024
@cjj196
Copy link

cjj196 commented Apr 11, 2024

We are getting the same exact error when doing the same steps as well

@RobiNino
Copy link
Contributor

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

@RobiNino
Copy link
Contributor

RobiNino commented Feb 5, 2025

Hi @davidpr @cjj196 ,
I'm closing this issue now, feel free to reopen if further assistance is required.
Thanks

@RobiNino RobiNino closed this as completed Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants