mirror of
https://github.com/certbot/certbot.git
synced 2026-06-11 01:30:14 -04:00
Fix #690
This commit is contained in:
parent
5ba6446458
commit
d8663fbbc0
2 changed files with 12 additions and 1 deletions
|
|
@ -75,7 +75,11 @@ class Reverter(object):
|
|||
backups = os.listdir(self.config.backup_dir)
|
||||
backups.sort()
|
||||
|
||||
if len(backups) < rollback:
|
||||
if len(backups) == 0:
|
||||
logger.warning(
|
||||
"Let's Encrypt hasn't modified your configuration, so rollback "
|
||||
"isn't available.")
|
||||
elif len(backups) < rollback:
|
||||
logger.warning("Unable to rollback %d checkpoints, only %d exist",
|
||||
rollback, len(backups))
|
||||
|
||||
|
|
|
|||
|
|
@ -343,9 +343,16 @@ class TestFullCheckpointsReverter(unittest.TestCase):
|
|||
|
||||
@mock.patch("letsencrypt.reverter.logger")
|
||||
def test_rollback_too_many(self, mock_logger):
|
||||
# Test no exist warning...
|
||||
self.reverter.rollback_checkpoints(1)
|
||||
self.assertEqual(mock_logger.warning.call_count, 1)
|
||||
|
||||
# Test Generic warning
|
||||
mock_logger.warning.call_count = 0
|
||||
self._setup_three_checkpoints()
|
||||
self.reverter.rollback_checkpoints(4)
|
||||
self.assertEqual(mock_logger.warning.call_count, 1)
|
||||
|
||||
def test_multi_rollback(self):
|
||||
config3 = self._setup_three_checkpoints()
|
||||
self.reverter.rollback_checkpoints(3)
|
||||
|
|
|
|||
Loading…
Reference in a new issue