Revert "Removed revert_challenge_config"

This reverts commit 0143d77362.
This commit is contained in:
Brad Warren
2015-11-10 16:31:52 -08:00
parent 1bb063e870
commit 3c00afd55c
2 changed files with 26 additions and 0 deletions
@@ -164,6 +164,18 @@ class AugeasConfigurator(common.Plugin):
# Need to reload configuration after these changes take effect
self.aug.load()
def revert_challenge_config(self):
"""Used to cleanup challenge configurations.
:raises .errors.PluginError: If unable to revert the challenge config.
"""
try:
self.reverter.revert_temporary_config()
except errors.ReverterError as err:
raise errors.PluginError(str(err))
self.aug.load()
def rollback_checkpoints(self, rollback=1):
"""Rollback saved checkpoints.
@@ -76,6 +76,20 @@ class AugeasConfiguratorTest(util.ApacheTest):
self.assertRaises(
errors.PluginError, self.config.recovery_routine)
def test_revert_challenge_config(self):
mock_load = mock.Mock()
self.config.aug.load = mock_load
self.config.revert_challenge_config()
self.assertEqual(mock_load.call_count, 1)
def test_revert_challenge_config_error(self):
self.config.reverter.revert_temporary_config = mock.Mock(
side_effect=errors.ReverterError)
self.assertRaises(
errors.PluginError, self.config.revert_challenge_config)
def test_rollback_checkpoints(self):
mock_load = mock.Mock()
self.config.aug.load = mock_load