While working on other changes I noticed that if _customize_resource
does not return a resource object (something fairly easy to do like
accidentally delete a line) the error it produces is somewhat hard
to debug. Check the return from the function returns a non-false
object to provide better error reporting.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
_customize = getattr(resource_cls, '_customize_resource', None)
if _customize is not None:
resource = _customize(resource)
+ if not resource:
+ raise ValueError(
+ '_customize_resource must return a valid resource object,'
+ f' not {resource!r}'
+ )
return resource