UKCloud / maloja

A Python toolkit for use with your VMware cloud. You can survey existing infrastructure and automate the task of building VApps.
Apache License 2.0
2 stars 0 forks source link

Error on survey of orgVdcNetwork #40

Closed tundish closed 8 years ago

tundish commented 8 years ago
2016-03-28 15:15:13,163 ERROR   maloja.surveyor.on_orgVdcNetwork|'collections.OrderedDict' object has no attribute 'tag'

maloja==0.6.0

tundish commented 8 years ago

Added a test to recreate:

======================================================================
ERROR: test_dump_yaml_roundtrip (test.test_model.VmTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\Users\User\src\maloja\maloja\test\test_model.py", line 606, in test_dump_yaml_roundtrip
    rv = yaml_dumps(obj)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\main.py", line 250, in dump
    version=version, tags=tags, block_seq_indent=block_seq_indent)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\main.py", line 220, in dump_all
    dumper.represent(data)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 49, in represent
    node = self.represent_data(data)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 83, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "C:\Users\User\src\maloja\maloja\model.py", line 46, in dataobject_as_ordereddict
    OrderedDict([(k, getattr(data, k)) for k, v in data._defaults])
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 300, in represent_ordereddict
    return self.represent_omap(u'tag:yaml.org,2002:omap', data)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 750, in represent_omap
    node_item = self.represent_data({item_key: item_val})
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 83, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 297, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 682, in represent_mapping
    node_value = self.represent_data(item_value)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 83, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 289, in represent_list
    return self.represent_sequence(u'tag:yaml.org,2002:seq', data)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 636, in represent_sequence
    node_item = self.represent_data(item)
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 83, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File "C:\Users\User\src\maloja\maloja\model.py", line 51, in namedtuple_as_dict
    return dumper.represent_dict(data._asdict())
  File "C:\Users\User\py3.5.1\lib\site-packages\ruamel\yaml\representer.py", line 826, in represent_dict
    t = data.tag.value
AttributeError: 'collections.OrderedDict' object has no attribute 'tag'
tundish commented 8 years ago

This is triggered in the upstream YAML library. ruamel.yaml has changed its behaviour since v 0.10.12. Bug is observed with version 0.11.7.