From 31f97a011b6a563e1cec16c16422a288e4a6ea80 Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 22 Apr 2015 06:55:31 -0400 Subject: [PATCH] fix FloatingIP repr The FloatingIP repr added in d614dbcab9cc8c5732ce28c655738218e147aad7 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 d614dbcab9cc8c5732ce28c655738218e147aad7 Closes-Bug: #1437244 Change-Id: I8cedf418917157ce632606bef640049140134372 --- novaclient/tests/unit/v2/test_floating_ips.py | 6 ++++++ novaclient/tests/unit/v2/test_floating_ips_bulk.py | 5 +++++ novaclient/v2/floating_ips.py | 3 --- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/novaclient/tests/unit/v2/test_floating_ips.py b/novaclient/tests/unit/v2/test_floating_ips.py index 2b091a516..3a4775b1c 100644 --- a/novaclient/tests/unit/v2/test_floating_ips.py +++ b/novaclient/tests/unit/v2/test_floating_ips.py @@ -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("", + string) diff --git a/novaclient/tests/unit/v2/test_floating_ips_bulk.py b/novaclient/tests/unit/v2/test_floating_ips_bulk.py index 34c200f3b..f59150758 100644 --- a/novaclient/tests/unit/v2/test_floating_ips_bulk.py +++ b/novaclient/tests/unit/v2/test_floating_ips_bulk.py @@ -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('', "%s" % fl) diff --git a/novaclient/v2/floating_ips.py b/novaclient/v2/floating_ips.py index 7c625e997..cce92da25 100644 --- a/novaclient/v2/floating_ips.py +++ b/novaclient/v2/floating_ips.py @@ -24,9 +24,6 @@ class FloatingIP(base.Resource): """ self.manager.delete(self) - def __repr__(self): - return "" % self.address - class FloatingIPManager(base.ManagerWithFind): resource_class = FloatingIP