From 55b3145865b2dd5ce6ffd80dbc92c2a1fada775b Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Thu, 24 Aug 2023 16:02:53 -0400 Subject: [PATCH] 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. --- zaza/openstack/utilities/openstack.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index ddc56b8..ec6cee4 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -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: