From 26b9434648563cd6a9def2634a0ca587e98e0b25 Mon Sep 17 00:00:00 2001 From: Billy Olsen Date: Tue, 8 Feb 2022 15:22:34 -0700 Subject: [PATCH] Remove legacy checks Remove legacy checks from set_ha_mode in rabbit_utils.py as it checks for versions of rabbitmq which is less than version 3.0.0 which is not available in the archives for any supported releases. Change-Id: Ib21f6ae3f30eabaaa8d677c20a555ded4e6851d6 --- hooks/rabbit_utils.py | 22 ---------------------- unit_tests/test_rabbit_utils.py | 5 +---- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/hooks/rabbit_utils.py b/hooks/rabbit_utils.py index 794f5591..fd7b7194 100644 --- a/hooks/rabbit_utils.py +++ b/hooks/rabbit_utils.py @@ -777,14 +777,6 @@ def set_ha_mode(vhost, mode, params=None, sync_mode='automatic'): sync has to be done http://www.rabbitmq.com./ha.html#eager-synchronisation """ - - if caching_cmp_pkgrevno('rabbitmq-server', '3.0.0') < 0: - log(("Mirroring queues cannot be enabled, only supported " - "in rabbitmq-server >= 3.0"), level=WARNING) - log(("More information at http://www.rabbitmq.com/blog/" - "2012/11/19/breaking-things-with-rabbitmq-3-0"), level='INFO') - return - if mode == 'all': definition = { "ha-mode": "all", @@ -811,13 +803,6 @@ def clear_ha_mode(vhost, name='HA', force=False): """ Clear policy from the `vhost` by `name` """ - if cmp_pkgrevno('rabbitmq-server', '3.0.0') < 0: - log(("Mirroring queues not supported " - "in rabbitmq-server >= 3.0"), level=WARNING) - log(("More information at http://www.rabbitmq.com/blog/" - "2012/11/19/breaking-things-with-rabbitmq-3-0"), level='INFO') - return - log("Clearing '%s' policy from vhost '%s'" % (name, vhost), level='INFO') try: clear_policy(vhost, name) @@ -831,13 +816,6 @@ def set_all_mirroring_queues(enable): :param enable: if True then enable mirroring queue for all the vhosts, otherwise the HA policy is removed """ - if cmp_pkgrevno('rabbitmq-server', '3.0.0') < 0: - log(("Mirroring queues not supported " - "in rabbitmq-server >= 3.0"), level=WARNING) - log(("More information at http://www.rabbitmq.com/blog/" - "2012/11/19/breaking-things-with-rabbitmq-3-0"), level='INFO') - return - if enable: status_set('active', 'Checking queue mirroring is enabled') else: diff --git a/unit_tests/test_rabbit_utils.py b/unit_tests/test_rabbit_utils.py index 31e8574e..680b5874 100644 --- a/unit_tests/test_rabbit_utils.py +++ b/unit_tests/test_rabbit_utils.py @@ -1490,16 +1490,13 @@ class UtilsTests(CharmTestCase): mock_cmp_pkgrevno.return_value = -1 self.assertFalse(rabbit_utils.rabbit_supports_json()) - @mock.patch('rabbit_utils.caching_cmp_pkgrevno') @mock.patch('rabbit_utils.set_policy') @mock.patch('rabbit_utils.config') def test_set_ha_mode(self, mock_config, - mock_set_policy, - mock_caching_cmp_pkgrevno): + mock_set_policy): """Testing set_ha_mode""" mock_config.side_effect = self.test_config - mock_caching_cmp_pkgrevno.return_value = 1 expected_policy = { 'all': {