python-ironicclient/releasenotes/notes/no-resource-attributeerror-d0cb327abab7dcc0.yaml
Ruby Loo 109b438527 If no resource, don't call Resource.to_dict()
This adds a new method base.Manager._get_as_dict() which
checks whether there is a resource first, before calling
Resource.to_dict(). Code was modified to call this new
method, instead of calling Resource.to_dict() directly.

This fixes the AttributeError that occurs if, for example, one
tries to get the list of driver passthru methods of the 'fake'
driver (via 'ironic driver-get-vendor-passthru-methods fake').
There are no methods, and without this change, an AttributeError
exception is raised. With this fix, an empty list is returned.

Change-Id: Ib6b691cd39ede9c5902b4df29023fd974b367a7d
Closes-Bug: #1626806
2016-10-04 12:10:08 -04:00

9 lines
415 B
YAML

---
fixes:
- For node resources that had no boot devices, no supported boot devices, or
no passthru methods (and driver resources with no properties or no passthru
methods), issuing a request to get that information (for example,
'ironic driver-get-vendor-passthru-methods fake') would result in the
error "'NoneType' has no attribute 'to_dict'". This is fixed; an empty
list is now returned.