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
This commit is contained in:
parent
09ce13aaf2
commit
26b9434648
|
@ -777,14 +777,6 @@ def set_ha_mode(vhost, mode, params=None, sync_mode='automatic'):
|
||||||
sync has to be done
|
sync has to be done
|
||||||
http://www.rabbitmq.com./ha.html#eager-synchronisation
|
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':
|
if mode == 'all':
|
||||||
definition = {
|
definition = {
|
||||||
"ha-mode": "all",
|
"ha-mode": "all",
|
||||||
|
@ -811,13 +803,6 @@ def clear_ha_mode(vhost, name='HA', force=False):
|
||||||
"""
|
"""
|
||||||
Clear policy from the `vhost` by `name`
|
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')
|
log("Clearing '%s' policy from vhost '%s'" % (name, vhost), level='INFO')
|
||||||
try:
|
try:
|
||||||
clear_policy(vhost, name)
|
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,
|
:param enable: if True then enable mirroring queue for all the vhosts,
|
||||||
otherwise the HA policy is removed
|
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:
|
if enable:
|
||||||
status_set('active', 'Checking queue mirroring is enabled')
|
status_set('active', 'Checking queue mirroring is enabled')
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1490,16 +1490,13 @@ class UtilsTests(CharmTestCase):
|
||||||
mock_cmp_pkgrevno.return_value = -1
|
mock_cmp_pkgrevno.return_value = -1
|
||||||
self.assertFalse(rabbit_utils.rabbit_supports_json())
|
self.assertFalse(rabbit_utils.rabbit_supports_json())
|
||||||
|
|
||||||
@mock.patch('rabbit_utils.caching_cmp_pkgrevno')
|
|
||||||
@mock.patch('rabbit_utils.set_policy')
|
@mock.patch('rabbit_utils.set_policy')
|
||||||
@mock.patch('rabbit_utils.config')
|
@mock.patch('rabbit_utils.config')
|
||||||
def test_set_ha_mode(self,
|
def test_set_ha_mode(self,
|
||||||
mock_config,
|
mock_config,
|
||||||
mock_set_policy,
|
mock_set_policy):
|
||||||
mock_caching_cmp_pkgrevno):
|
|
||||||
"""Testing set_ha_mode"""
|
"""Testing set_ha_mode"""
|
||||||
mock_config.side_effect = self.test_config
|
mock_config.side_effect = self.test_config
|
||||||
mock_caching_cmp_pkgrevno.return_value = 1
|
|
||||||
|
|
||||||
expected_policy = {
|
expected_policy = {
|
||||||
'all': {
|
'all': {
|
||||||
|
|
Loading…
Reference in New Issue