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

Jmespath: object projection is broken #1365

Closed
yugangw-msft opened this issue Nov 17, 2016 · 2 comments
Closed

Jmespath: object projection is broken #1365

yugangw-msft opened this issue Nov 17, 2016 · 2 comments
Assignees
Labels

Comments

@yugangw-msft
Copy link
Contributor

yugangw-msft commented Nov 17, 2016

The following command returns nothing. If you remove the OrderedDict in our query.py, things works.

az vm show -g vm -n vm-1 --query "{n:name}"

Either Jmespath or us have bug, which need to be fixed anyway

@derekbekoe
Copy link
Member

I would refer to this commit - adaf644.
Commit description:
"Avoid unexpected reordering of dictionaries from how it was specified in the JMESPath expression for the --query parameter.

Especially annoying when using the tsv output formatter...."

cc: @johanste

@derekbekoe
Copy link
Member

On version 0.1.0b9, I get a stack trace.

$ az vm show -g myrg -n abcdefg --query '{n:name}'
Circular reference detected
Traceback (most recent call last):
  File "/Users/debekoe/Library/Python/2.7/lib/python/site-packages/azure/cli/main.py", line 39, in main
    OutputProducer(formatter=formatter, file=file).out(cmd_result)
  File "/Users/debekoe/Library/Python/2.7/lib/python/site-packages/azure/cli/core/_output.py", line 107, in out
    output = self.formatter(obj)
  File "/Users/debekoe/Library/Python/2.7/lib/python/site-packages/azure/cli/core/_output.py", line 39, in format_json
    separators=(',', ': ')) + '\n'
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 250, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py", line 295, in _iterencode_list
    raise ValueError("Circular reference detected")
ValueError: Circular reference detected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants