From 9ce03a98eb78652fd3480cb0d8323520fd78064c Mon Sep 17 00:00:00 2001 From: melanie witt Date: Mon, 28 Jul 2014 18:54:01 +0000 Subject: [PATCH] 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 --- novaclient/tests/v1_1/test_hosts.py | 4 ++++ novaclient/v1_1/hosts.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/novaclient/tests/v1_1/test_hosts.py b/novaclient/tests/v1_1/test_hosts.py index d8291c6ae..8fcdf5a76 100644 --- a/novaclient/tests/v1_1/test_hosts.py +++ b/novaclient/tests/v1_1/test_hosts.py @@ -78,3 +78,7 @@ class HostsTest(utils.FixturedTestCase): host.shutdown() self.assert_called( 'GET', '/os-hosts/sample_host/shutdown') + + def test_hosts_repr(self): + hs = self.cs.hosts.get('host') + self.assertEqual('', repr(hs[0])) diff --git a/novaclient/v1_1/hosts.py b/novaclient/v1_1/hosts.py index 0b641d44c..af1756ad2 100644 --- a/novaclient/v1_1/hosts.py +++ b/novaclient/v1_1/hosts.py @@ -21,7 +21,7 @@ from novaclient import base class Host(base.Resource): def __repr__(self): - return "" % self.host_name + return "" % self.host def _add_details(self, info): dico = 'resource' in info and info['resource'] or info