fix host resource repr to use 'host' attribute
This change fixes an AttributeError raised when attempting to represent a host resource as a string. Change-Id: I33369b20ed7f5219c3b507107b8f3a37b46eacee Closes-Bug: #1327005
This commit is contained in:
parent
50b1068ba6
commit
9ce03a98eb
novaclient
@ -78,3 +78,7 @@ class HostsTest(utils.FixturedTestCase):
|
|||||||
host.shutdown()
|
host.shutdown()
|
||||||
self.assert_called(
|
self.assert_called(
|
||||||
'GET', '/os-hosts/sample_host/shutdown')
|
'GET', '/os-hosts/sample_host/shutdown')
|
||||||
|
|
||||||
|
def test_hosts_repr(self):
|
||||||
|
hs = self.cs.hosts.get('host')
|
||||||
|
self.assertEqual('<Host: dummy>', repr(hs[0]))
|
||||||
|
@ -21,7 +21,7 @@ from novaclient import base
|
|||||||
|
|
||||||
class Host(base.Resource):
|
class Host(base.Resource):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Host: %s>" % self.host_name
|
return "<Host: %s>" % self.host
|
||||||
|
|
||||||
def _add_details(self, info):
|
def _add_details(self, info):
|
||||||
dico = 'resource' in info and info['resource'] or info
|
dico = 'resource' in info and info['resource'] or info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user