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
This commit is contained in:
Takashi NATSUME 2018-04-03 09:37:51 +09:00
parent d4df771868
commit e044b911c2
1 changed files with 2 additions and 1 deletions

View File

@ -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."""