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
This commit is contained in:
parent
810857849e
commit
5e3a3a193b
@ -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')
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user