Skip to content

Commit

Permalink
fix host resource repr to use 'host' attribute
Browse files Browse the repository at this point in the history
This change fixes an AttributeError raised when attempting to
represent a host resource as a string.

Change-Id: I33369b20ed7f5219c3b507107b8f3a37b46eacee
Closes-Bug: #1327005
  • Loading branch information
melanie witt committed Jul 28, 2014
1 parent 50b1068 commit 9ce03a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions novaclient/tests/v1_1/test_hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ def test_host_shutdown(self):
host.shutdown()
self.assert_called(
'GET', '/os-hosts/sample_host/shutdown')

def test_hosts_repr(self):
hs = self.cs.hosts.get('host')
self.assertEqual('<Host: dummy>', repr(hs[0]))
2 changes: 1 addition & 1 deletion novaclient/v1_1/hosts.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

class Host(base.Resource):
def __repr__(self):
return "<Host: %s>" % self.host_name
return "<Host: %s>" % self.host

def _add_details(self, info):
dico = 'resource' in info and info['resource'] or info
Expand Down

0 comments on commit 9ce03a9

Please sign in to comment.