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