-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Can't filter using JMESPath query on integers #11984
Comments
@qwordy please take a look. |
I'm running into the same issue and same error message when listing blobs and trying to filter them by content length. So this is really not an issue related to VMs but rather to the JMESPath implementation in CLI.
also results in the error message described above. Using http://jmespath.org/ I can validate that the query is correct. |
According to JMESPath specification, for Filter Expressions, numbers need to be quoted by backtick To get a list of VM sizes where the name contains _B and the number of CPU cores is 4, on Windows:
On Linux, since
To filter out non-empty blobs, on Windows
On Linux, use either
|
@yooakim Is your problem solved? |
@qwordy - yes, I think it is. Let's close this for now. |
I found the workarounds above did not work for me in my environment: I used this workaround - converted the source value to compare from an integer to a string, so the integer comparison is never needed: Pre-req: https://jmespath.org/specification.html#built-in-functions See --query to_string usage on last line:
|
interestingly backticks dont work out always the same.
|
Share some learnings: If the value is non-string, need to use ` instead of ‘ You can find out if the value is string or not by observing if it's quoted. |
another learning |
I want to retrieve a list of VM sizes where the name contains _B and the number of CPU cores is 4 - so I try this AZ CLI command:
which works fine. but when I try to add the filter for number of cores it does not work:
I have also tried this:
but of course I don't get the expected result as 4 should be an integer.
It seems as if the version of JMESPath used by Azure CLI does not work with integers? Or am I doing something wrong?
Command Name
az vm list-sizes
Errors:
To Reproduce:
Run the following in an Azure CLI command line:
Expected Behavior
I expected to get a filtered list where only sizes with numberOfCores = 4 would be listed.
Environment Summary
Additional Context
The text was updated successfully, but these errors were encountered: