From e044b911c2f8a982a4514878762e01f3b668c18c Mon Sep 17 00:00:00 2001 From: Takashi NATSUME Date: Tue, 3 Apr 2018 09:37:51 +0900 Subject: [PATCH] Fix AttributeError in getting a resource ID In the 'wait_for_resource_delete' method of the 'ClientTestBase' class, the following statement is executed when timeout. self.fail("The resource '%s' still exists." % resource.id) The 'resource' variable is passed in the argument of the 'wait_for_resource_delete' method. It is sometimes a string which is a resource ID. When it is a string (a resource ID), AttributeError is raised at the statement. This patch fixes the issue. Change-Id: I558026de54a5cc75359225b50054934a220f3e5c Closes-Bug: #1704132 --- novaclient/tests/functional/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/novaclient/tests/functional/base.py b/novaclient/tests/functional/base.py index 2c83f3027..57f822b2d 100644 --- a/novaclient/tests/functional/base.py +++ b/novaclient/tests/functional/base.py @@ -29,6 +29,7 @@ import testtools import novaclient import novaclient.api_versions +from novaclient import base import novaclient.client from novaclient.v2 import networks import novaclient.v2.shell @@ -371,7 +372,7 @@ class ClientTestBase(testtools.TestCase): raise time.sleep(poll_interval) else: - self.fail("The resource '%s' still exists." % resource.id) + self.fail("The resource '%s' still exists." % base.getid(resource)) def name_generate(self): """Generate randomized name for some entity."""