From 0bc12859871c86673b321a09141dccc2e40de5f9 Mon Sep 17 00:00:00 2001 From: Sam Doran Date: Tue, 3 Sep 2019 13:44:21 -0400 Subject: [PATCH] [stable-2.8] fixes issue with recieve parameter idempotency (#59999) (#60541) * [stable-2.8] fixes issue with recieve parameter idempotency (#59999) fixes assert statements in unit tests (cherry picked from commit c9a9621a022fb6af476a3a4e3353f188c367e047) Co-authored-by: Wojciech Wypior * Add changelog --- .../fragments/bigip-monitor-http-receive-parameter.yaml | 2 ++ lib/ansible/modules/network/f5/bigip_monitor_http.py | 4 ++++ lib/ansible/modules/network/f5/bigip_monitor_https.py | 4 ++++ .../modules/network/f5/test_bigip_device_connectivity.py | 2 +- test/units/modules/network/f5/test_bigip_gtm_wide_ip.py | 2 +- test/units/modules/network/f5/test_bigip_monitor_http.py | 4 ++-- test/units/modules/network/f5/test_bigip_monitor_https.py | 4 ++-- 7 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/bigip-monitor-http-receive-parameter.yaml diff --git a/changelogs/fragments/bigip-monitor-http-receive-parameter.yaml b/changelogs/fragments/bigip-monitor-http-receive-parameter.yaml new file mode 100644 index 00000000000..5ca27f7f288 --- /dev/null +++ b/changelogs/fragments/bigip-monitor-http-receive-parameter.yaml @@ -0,0 +1,2 @@ +bugfixes: + - bigip_monitor_http - fix issue with receive parameter idempotency (https://github.com/ansible/ansible/pull/59999) diff --git a/lib/ansible/modules/network/f5/bigip_monitor_http.py b/lib/ansible/modules/network/f5/bigip_monitor_http.py index e568d3f8750..e387d206fc9 100644 --- a/lib/ansible/modules/network/f5/bigip_monitor_http.py +++ b/lib/ansible/modules/network/f5/bigip_monitor_http.py @@ -481,6 +481,10 @@ class Difference(object): def description(self): return cmp_str_with_none(self.want.description, self.have.description) + @property + def receive(self): + return cmp_str_with_none(self.want.receive, self.have.receive) + @property def receive_disable(self): return cmp_str_with_none(self.want.receive_disable, self.have.receive_disable) diff --git a/lib/ansible/modules/network/f5/bigip_monitor_https.py b/lib/ansible/modules/network/f5/bigip_monitor_https.py index 5cd06a5bb1e..adc623124b3 100644 --- a/lib/ansible/modules/network/f5/bigip_monitor_https.py +++ b/lib/ansible/modules/network/f5/bigip_monitor_https.py @@ -485,6 +485,10 @@ class Difference(object): def description(self): return cmp_str_with_none(self.want.description, self.have.description) + @property + def receive(self): + return cmp_str_with_none(self.want.receive, self.have.receive) + @property def receive_disable(self): return cmp_str_with_none(self.want.receive_disable, self.have.receive_disable) diff --git a/test/units/modules/network/f5/test_bigip_device_connectivity.py b/test/units/modules/network/f5/test_bigip_device_connectivity.py index 3950199b630..d0398badbd4 100644 --- a/test/units/modules/network/f5/test_bigip_device_connectivity.py +++ b/test/units/modules/network/f5/test_bigip_device_connectivity.py @@ -292,7 +292,7 @@ class TestManager(unittest.TestCase): with pytest.raises(F5ModuleError) as ex: mm.exec_module() - assert 'must be between' in str(ex) + assert 'must be between' in str(ex.value) def test_set_multicast_address(self, *args): set_module_args(dict( diff --git a/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py b/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py index 4f872f91cc7..348a43dba2d 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py +++ b/test/units/modules/network/f5/test_bigip_gtm_wide_ip.py @@ -120,7 +120,7 @@ class TestParameters(unittest.TestCase): with pytest.raises(F5ModuleError) as excinfo: p = ModuleParameters(params=args) assert p.name == 'foo' - assert 'The provided name must be a valid FQDN' in str(excinfo) + assert 'The provided name must be a valid FQDN' in str(excinfo.value) class TestUntypedManager(unittest.TestCase): diff --git a/test/units/modules/network/f5/test_bigip_monitor_http.py b/test/units/modules/network/f5/test_bigip_monitor_http.py index 70e237d1242..93d57e25728 100644 --- a/test/units/modules/network/f5/test_bigip_monitor_http.py +++ b/test/units/modules/network/f5/test_bigip_monitor_http.py @@ -305,7 +305,7 @@ class TestManager(unittest.TestCase): with pytest.raises(F5ModuleError) as ex: mm.exec_module() - assert "must be less than" in str(ex) + assert "must be less than" in str(ex.value) def test_update_interval_larger_than_new_timeout(self, *args): set_module_args(dict( @@ -335,7 +335,7 @@ class TestManager(unittest.TestCase): with pytest.raises(F5ModuleError) as ex: mm.exec_module() - assert "must be less than" in str(ex) + assert "must be less than" in str(ex.value) def test_update_send(self, *args): set_module_args(dict( diff --git a/test/units/modules/network/f5/test_bigip_monitor_https.py b/test/units/modules/network/f5/test_bigip_monitor_https.py index 6e21ad11ca0..700806f803f 100644 --- a/test/units/modules/network/f5/test_bigip_monitor_https.py +++ b/test/units/modules/network/f5/test_bigip_monitor_https.py @@ -305,7 +305,7 @@ class TestManager(unittest.TestCase): with pytest.raises(F5ModuleError) as ex: mm.exec_module() - assert "must be less than" in str(ex) + assert "must be less than" in str(ex.value) def test_update_interval_larger_than_new_timeout(self, *args): set_module_args(dict( @@ -335,7 +335,7 @@ class TestManager(unittest.TestCase): with pytest.raises(F5ModuleError) as ex: mm.exec_module() - assert "must be less than" in str(ex) + assert "must be less than" in str(ex.value) def test_update_send(self, *args): set_module_args(dict(