summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasayuki Igawa <igawa@mxs.nes.nec.co.jp>2014-02-04 15:53:16 +0900
committerMasayuki Igawa <igawa@mxs.nes.nec.co.jp>2014-02-05 13:31:33 +0900
commit5e3a3a193bb55cd9f0622b0adb76ffa54b98b906 (patch)
tree75f6d4e95f4cc906538e61c992276d1c161a7a61
parent810857849ed32773c38df12785715f89d33e83af (diff)
downloadpython-novaclient-5e3a3a193bb55cd9f0622b0adb76ffa54b98b906.tar.gz
Fix Serivce class AttributeError
When we str(service_object), an AttributeError occurred like this: ======================== File "/opt/stack/python-novaclient/novaclient/v1_1/services.py", line 24, in __repr__ return "<Service: %s>" % self.service File "/opt/stack/python-novaclient/novaclient/openstack/common/apiclient/base.py", line 463, in __getattr__ raise AttributeError(k) AttributeError: service ======================== This commit fixes it. Change-Id: I496d522591273bf1b1e7dbadf19afaf5e64e41e3 Closes-Bug: #1276408
-rw-r--r--novaclient/tests/v1_1/test_services.py1
-rw-r--r--novaclient/v1_1/services.py2
2 files changed, 2 insertions, 1 deletions
diff --git a/novaclient/tests/v1_1/test_services.py b/novaclient/tests/v1_1/test_services.py
index 36f82e40..d66a1110 100644
--- a/novaclient/tests/v1_1/test_services.py
+++ b/novaclient/tests/v1_1/test_services.py
@@ -37,6 +37,7 @@ class ServicesTest(utils.TestCase):
self.assertIsInstance(s, self._get_service_type())
self.assertEqual(s.binary, 'nova-compute')
self.assertEqual(s.host, 'host1')
+ self.assertTrue(str(s).startswith('<Service: '))
def test_list_services_with_hostname(self):
svs = self.cs.services.list(host='host2')
diff --git a/novaclient/v1_1/services.py b/novaclient/v1_1/services.py
index 45dafbc5..f2588eaa 100644
--- a/novaclient/v1_1/services.py
+++ b/novaclient/v1_1/services.py
@@ -21,7 +21,7 @@ from novaclient import base
class Service(base.Resource):
def __repr__(self):
- return "<Service: %s>" % self.service
+ return "<Service: %s>" % self.binary
def _add_details(self, info):
dico = 'resource' in info and info['resource'] or info