Merge "Remove old configure_stonith"

This commit is contained in:
Zuul 2020-07-20 14:34:21 +00:00 committed by Gerrit Code Review
commit d2c7ed2821
2 changed files with 14 additions and 15 deletions

View File

@ -505,6 +505,16 @@ def parse_data(relid, unit, key):
def configure_stonith():
if configure_pacemaker_remote_stonith_resource():
log('Not disabling STONITH as pacemaker remotes are present',
level=INFO)
else:
log('Disabling STONITH', level=INFO)
cmd = "crm configure property stonith-enabled=false"
pcmk.commit(cmd)
def configure_legacy_stonith():
if config('stonith_enabled') not in ['true', 'True', True]:
if configure_pacemaker_remote_stonith_resource():
log('Not disabling STONITH as pacemaker remotes are present',
@ -1182,6 +1192,10 @@ def assess_status_helper():
@returns status, message - status is workload status and message is any
corresponding messages
"""
if config('stonith_enabled') in ['true', 'True', True]:
return(
'blocked',
'stonith_enabled config option is no longer supported')
if is_unit_upgrading_set():
return ("blocked",

View File

@ -445,21 +445,6 @@ class UtilsTestCase(unittest.TestCase):
mock_commit.assert_called_once_with(
'crm configure property stonith-enabled=false')
@mock.patch('pcmk.commit')
@mock.patch.object(utils, 'config')
@mock.patch.object(utils, 'configure_pacemaker_remote_stonith_resource')
def test_configure_stonith_stonith_enabled_false_pcmkr_remote(
self,
mock_cfg_pcmkr_rstonith_res,
mock_config,
mock_commit):
cfg = {
'stonith_enabled': 'false'}
mock_config.side_effect = lambda key: cfg.get(key)
mock_cfg_pcmkr_rstonith_res.return_value = ['st-res']
utils.configure_stonith()
self.assertFalse(mock_commit.called)
@mock.patch.object(utils, 'relation_get')
def test_parse_data_json(self, relation_get):
_rel_data = {