fix FloatingIP repr

The FloatingIP repr added in d614dbcab9
is incorrect, and can cause fails when you attempt to do bulk creation
activities with logging turned on.

This removes the __repr__ for FloatingIP so that it fails back to the
Resource defaults which are safe.

Partial Revert of d614dbcab9

Closes-Bug: #1437244

Change-Id: I8cedf418917157ce632606bef640049140134372
This commit is contained in:
Sean Dague 2015-04-22 06:55:31 -04:00
parent 5eab1430f2
commit 31f97a011b
3 changed files with 11 additions and 3 deletions

View File

@ -57,3 +57,9 @@ class FloatingIPsTest(utils.FixturedTestCase):
self.assert_called('POST', '/os-floating-ips')
self.assertEqual('nova', fl.pool)
self.assertIsInstance(fl, floating_ips.FloatingIP)
def test_repr(self):
fl = self.cs.floating_ips.list()[0]
string = "%s" % fl
self.assertEqual("<FloatingIP fixed_ip=10.0.0.1, id=1, ip=11.0.0.1>",
string)

View File

@ -62,3 +62,8 @@ class FloatingIPsBulkTest(utils.FixturedTestCase):
body = {'ip_range': '192.168.1.0/30'}
self.assert_called('PUT', '/os-floating-ips-bulk/delete', body)
self.assertEqual(fl.floating_ips_bulk_delete, body['ip_range'])
def test_repr(self):
fl = self.cs.floating_ips_bulk.create('192.168.1.0/30', 'poolTest',
'interfaceTest')
self.assertEqual('<FloatingIPRange: 192.168.1.0/30>', "%s" % fl)

View File

@ -24,9 +24,6 @@ class FloatingIP(base.Resource):
"""
self.manager.delete(self)
def __repr__(self):
return "<FloatingIP: %s>" % self.address
class FloatingIPManager(base.ManagerWithFind):
resource_class = FloatingIP