Skip to content

'Circular reference detected' in query on az vm get-instance-view #1359

Closed
@tkeber

Description

@tkeber
az vm get-instance-view --resource-group 'RGROUP' --name Name --query '{UUU: name, VVV: instanceView.statuses[1].code}'`

Throws an execption:

Circular reference detected
Traceback (most recent call last):
  File "/opt/az/local/lib/python2.7/site-packages/azure/cli/main.py", line 39, in main
    OutputProducer(formatter=formatter, file=file).out(cmd_result)
  File "/opt/az/local/lib/python2.7/site-packages/azure/cli/core/_output.py", line 107, in out
    output = self.formatter(obj)
  File "/opt/az/local/lib/python2.7/site-packages/azure/cli/core/_output.py", line 39, in format_json
    separators=(',', ': ')) + '\n'
  File "/usr/lib/python2.7/json/__init__.py", line 250, in dumps
    sort_keys=sort_keys, **kw).encode(obj)
  File "/usr/lib/python2.7/json/encoder.py", line 209, in encode
    chunks = list(chunks)
  File "/usr/lib/python2.7/json/encoder.py", line 434, in _iterencode
    for chunk in _iterencode_dict(o, _current_indent_level):
  File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 408, in _iterencode_dict
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 332, in _iterencode_list
    for chunk in chunks:
  File "/usr/lib/python2.7/json/encoder.py", line 295, in _iterencode_list
    raise ValueError("Circular reference detected")
ValueError: Circular reference detected

There is no Problem when the query is modified to return the same elements in an array:

 az vm get-instance-view --resource-group 'RGROUP' --name Name --query '[name, instanceView.statuses[1].code]'
[
  "Name",
  "PowerState/running"
]

This happens on ubuntu trusty in a vagrant box (2048MB ram):

vagrant@vagrant-ubuntu-trusty-64:~$ az --version
azure-cli (0.1.0b9)

acr (0.1.0b9)
acs (0.1.0b9)
appservice (0.1.0b9)
cloud (0.1.0b9)
component (0.1.0b9)
configure (0.1.0b9)
container (0.1.0b9)
context (0.1.0b9)
core (0.1.0b9)
feedback (0.1.0b9)
network (0.1.0b9)
profile (0.1.0b9)
resource (0.1.0b9)
role (0.1.0b9)
storage (0.1.0b9)
vm (0.1.0b9)

Python (Linux) 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2]

Metadata

Metadata

Assignees

Labels

Computeaz vm/vmss/image/disk/snapshotbugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions