Log available attributes on AttributeError

This simplifies when developing new tests and the programmer is not too
familiar with the different attributes an object has.
This commit is contained in:
Felipe Reyes
2023-08-24 16:02:53 -04:00
parent 11c3f80d5e
commit 55b3145865

View File

@@ -2450,7 +2450,13 @@ def _resource_reaches_status(resource, resource_id,
:raises: AssertionError
:raises: StatusError
"""
resource_status = getattr(resource.get(resource_id), resource_attribute)
try:
res_object = resource.get(resource_id)
resource_status = getattr(res_object, resource_attribute)
except AttributeError:
logging.error('attributes available: %s' % str(dir(res_object)))
raise
logging.info("{}: resource {} in {} state, waiting for {}".format(
msg, resource_id, resource_status, expected_status))
if stop_status: