mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:41:53 +02:00
Fix certbot config_changes (#7197)
* Remove for_logging parameter. * Remove broken/unused --num parameter. * update changelog
This commit is contained in:
@@ -15,6 +15,7 @@ Certbot adheres to [Semantic Versioning](https://semver.org/).
|
||||
* Update the 'manage your account' help to be more generic.
|
||||
* The error message when Certbot's Apache plugin is unable to modify your
|
||||
Apache configuration has been improved.
|
||||
* `certbot config_changes` no longer accepts a --num parameter.
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
+2
-5
@@ -418,8 +418,8 @@ VERB_HELP = [
|
||||
}),
|
||||
("config_changes", {
|
||||
"short": "Show changes that Certbot has made to server configurations",
|
||||
"opts": "Options for controlling which changes are displayed",
|
||||
"usage": "\n\n certbot config_changes --num NUM [options]\n\n"
|
||||
"opts": "Options for viewing configuration changes",
|
||||
"usage": "\n\n certbot config_changes [options]\n\n"
|
||||
}),
|
||||
("rollback", {
|
||||
"short": "Roll back server conf changes made during certificate installation",
|
||||
@@ -1289,9 +1289,6 @@ def prepare_and_parse_args(plugins, args, detect_defaults=False): # pylint: dis
|
||||
|
||||
|
||||
def _create_subparsers(helpful):
|
||||
helpful.add("config_changes", "--num", type=int, default=flag_default("num"),
|
||||
help="How many past revisions you want to be displayed")
|
||||
|
||||
from certbot.client import sample_user_agent # avoid import loops
|
||||
helpful.add(
|
||||
None, "--user-agent", default=flag_default("user_agent"),
|
||||
|
||||
+2
-2
@@ -702,7 +702,7 @@ def rollback(default_installer, checkpoints, config, plugins):
|
||||
installer.restart()
|
||||
|
||||
|
||||
def view_config_changes(config, num=None):
|
||||
def view_config_changes(config):
|
||||
"""View checkpoints and associated configuration changes.
|
||||
|
||||
.. note:: This assumes that the installation is using a Reverter object.
|
||||
@@ -713,7 +713,7 @@ def view_config_changes(config, num=None):
|
||||
"""
|
||||
rev = reverter.Reverter(config)
|
||||
rev.recovery_routine()
|
||||
rev.view_config_changes(num)
|
||||
rev.view_config_changes()
|
||||
|
||||
def _open_pem_file(cli_arg_path, pem_path):
|
||||
"""Open a pem file.
|
||||
|
||||
+1
-1
@@ -976,7 +976,7 @@ def config_changes(config, unused_plugins):
|
||||
:rtype: None
|
||||
|
||||
"""
|
||||
client.view_config_changes(config, num=config.num)
|
||||
client.view_config_changes(config)
|
||||
|
||||
def update_symlinks(config, unused_plugins):
|
||||
"""Update the certificate file family symlinks
|
||||
|
||||
+1
-5
@@ -132,7 +132,7 @@ class Reverter(object):
|
||||
"Unable to load checkpoint during rollback")
|
||||
rollback -= 1
|
||||
|
||||
def view_config_changes(self, for_logging=False, num=None):
|
||||
def view_config_changes(self):
|
||||
"""Displays all saved checkpoints.
|
||||
|
||||
All checkpoints are printed by
|
||||
@@ -145,8 +145,6 @@ class Reverter(object):
|
||||
"""
|
||||
backups = os.listdir(self.config.backup_dir)
|
||||
backups.sort(reverse=True)
|
||||
if num:
|
||||
backups = backups[:num]
|
||||
if not backups:
|
||||
logger.info("Certbot has not saved backups of your configuration")
|
||||
|
||||
@@ -182,8 +180,6 @@ class Reverter(object):
|
||||
|
||||
output.append(os.linesep)
|
||||
|
||||
if for_logging:
|
||||
return os.linesep.join(output)
|
||||
zope.component.getUtility(interfaces.IDisplay).notification(
|
||||
os.linesep.join(output), force_interactive=True, pause=False)
|
||||
return None
|
||||
|
||||
@@ -400,15 +400,6 @@ class TestFullCheckpointsReverter(test_util.ConfigTestCase):
|
||||
self.assertRaises(
|
||||
errors.ReverterError, self.reverter.view_config_changes)
|
||||
|
||||
def test_view_config_changes_for_logging(self):
|
||||
self._setup_three_checkpoints()
|
||||
|
||||
config_changes = self.reverter.view_config_changes(for_logging=True)
|
||||
|
||||
self.assertTrue("First Checkpoint" in config_changes)
|
||||
self.assertTrue("Second Checkpoint" in config_changes)
|
||||
self.assertTrue("Third Checkpoint" in config_changes)
|
||||
|
||||
def _setup_three_checkpoints(self):
|
||||
"""Generate some finalized checkpoints."""
|
||||
# Checkpoint1 - config1
|
||||
|
||||
Reference in New Issue
Block a user