ironic/releasenotes/notes/fix-cleaning-with-traits-3a54faa70d594fd0.yaml
Mark Goddard c66679f14b Support nested objects and object lists in as_dict
The value returned by ironic.objects.IronicObject.as_dict() should be a
plain object, in order for it to be serialised to JSON. Currently,
nested object fields and object list fields are not converted to dict
format. This caused problems during cleaning, when the node object's
as_dict representation is JSON encoded and sent to IPA.

This change adds support for calling as_dict() on nested objects and
list objects, to ensure these are also returned in dict form.

We also change the method used in as_dict() for checking whether an
object has an attribute. The hasattr() function used previously has
problems when used with properties in python 2 [1], in that any
exceptions raised in the property getter result in hasattr() returning
False. Instead we use obj_attr_is_set() to determine whether the object
has a particular attribute.

[1] https://hynek.me/articles/hasattr/

Change-Id: Ib2166040508827db28d6f6e2d9a3e655c16f2993
Closes-Bug: #1750027
2018-02-22 00:29:58 +00:00

8 lines
298 B
YAML

---
fixes:
- |
Fixes an issue seen during cleaning when the node being cleaned has one or
more traits assigned. This issue caused cleaning to fail, and the node to
enter the ``clean failed`` state. See `bug 1750027
<https://bugs.launchpad.net/ironic/+bug/1750027>`_ for details.