More thoroughly rename during certbot rename. (#4320)

* rename more files in rename command

* Revert "Hide rename command (#4007)"

This reverts commit 8c14de13a5.

* Rename files in configuration files

* Delete new files if we fail during the renaming process

* update tests and error catching

* More expressive error message
This commit is contained in:
Erica Portnoy
2017-04-04 11:20:58 -07:00
committed by GitHub
parent e194e0dd5f
commit 43dccfc671
5 changed files with 157 additions and 27 deletions
+13 -2
View File
@@ -81,6 +81,7 @@ obtain, install, and renew certificates:
manage certificates:
certificates Display information about certs you have from Certbot
revoke Revoke a certificate (supply --cert-path)
rename Rename a certificate
delete Delete a certificate
manage your account with Let's Encrypt:
@@ -363,6 +364,10 @@ VERB_HELP = [
"opts": "Options for revocation of certs",
"usage": "\n\n certbot revoke --cert-path /path/to/fullchain.pem [options]\n\n"
}),
("rename", {
"short": "Change a certificate's name (for management purposes)",
"opts": "Options for changing certificate names"
}),
("register", {
"short": "Register for account with Let's Encrypt / other ACME server",
"opts": "Options for account registration & modification"
@@ -420,6 +425,7 @@ class HelpfulArgumentParser(object):
"plugins": main.plugins_cmd,
"register": main.register,
"unregister": main.unregister,
"rename": main.rename,
"renew": main.renew,
"revoke": main.revoke,
"rollback": main.rollback,
@@ -790,7 +796,7 @@ def _add_all_groups(helpful):
helpful.add_group("paths", description="Arguments changing execution paths & servers")
helpful.add_group("manage",
description="Various subcommands and flags are available for managing your certificates:",
verbs=["certificates", "delete", "renew", "revoke", "update_symlinks"])
verbs=["certificates", "delete", "rename", "renew", "revoke", "update_symlinks"])
# VERBS
for verb, docs in VERB_HELP:
@@ -843,12 +849,17 @@ def prepare_and_parse_args(plugins, args, detect_defaults=False): # pylint: dis
"multiple -d flags or enter a comma separated list of domains "
"as a parameter. (default: Ask)")
helpful.add(
[None, "run", "certonly", "manage", "delete", "certificates"],
[None, "run", "certonly", "manage", "rename", "delete", "certificates"],
"--cert-name", dest="certname",
metavar="CERTNAME", default=None,
help="Certificate name to apply. Only one certificate name can be used "
"per Certbot run. To see certificate names, run 'certbot certificates'. "
"When creating a new certificate, specifies the new certificate's name.")
helpful.add(
["rename", "manage"],
"--updated-cert-name", dest="new_certname",
metavar="NEW_CERTNAME", default=None,
help="New name for the certificate. Must be a valid filename.")
helpful.add(
[None, "testing", "renew", "certonly"],
"--dry-run", action="store_true", dest="dry_run",