-
Notifications
You must be signed in to change notification settings - Fork 195
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
JSONPath array problem: Invalid array index definition “?(@.booted == true)]” #2830
Comments
Thanks for the report. Unfortunately JSONPath capabilities are not standardized (yet) so different implementations somehow diverged in the language surface that they support over time. In this specific case, it looks like you are trying to use a language feature which is not supported by the While the library should be augmented to handle this syntax, for this specific usecase I think it's just quicker to directly fix #2829. |
I did some digging into |
Thanks, but is there any suggestion on what a supported syntax for me here would be now? For my specific use case? 🤔 Generally, I wonder why you choose JSONPath BTW, there a many different JSONPath-like “specifications” and after all one can also always |
Try something like this:
However,
If you want a package to be unconditionally installed, then you can just |
This notably handles the case where the package is currently in the base but then gets removed in a later OSTree update. The package request will go from "inactive" to "active". |
Thanks a lot! Though I’m not sure whether I understand the difference between these two parameters. Can these be used together? I.e. I ideally want to handle all cases, both if it is “inactive” and if it is already layered and of course if it is not yet layered. |
This was brought up in coreos#2830.
Thanks, I didn't realize Yes, they can be used together because they're independent.
Then yes Looking back now, I think |
Thanks a lot for that help! Of course I'll leave this issue open, because the original issue of some incomplete JSONPath support of course remains… |
Host system details
Fedora CoreOS 34.20210427.2.1
Same system as in #2829
I’m trying to get all layered packages from the current boot.
While I first tried to use
jq
(my tries got so far:rpm-ostree status --booted --json|jq '.deployments | .[booted=true] | .packages | .[]’
) I saw you haveJSONPath
built-in, so I tried to use that.My aim is to check whether one package is already installed (and if not, later install it) in some systemd service with a
Condition
…Expected vs actual behavior
Actually a MWE is:
Expected:
I tried the JSON path on https://jsonpath.curiousconcept.com/# and https://jsonpath.com/ and both implementation seem to be fine with that JSON and printed what I’ve written above.
You can copy the input JSON from #2829 again.
Would you like to work on the issue?
As it's either a deep technical problem or an oversight of me using this thing, no.
The text was updated successfully, but these errors were encountered: