mirror of
https://github.com/certbot/certbot.git
synced 2026-08-01 19:02:52 +02:00
Refactor --domain flag back to -- domains
This commit is contained in:
@@ -18,7 +18,7 @@ letsencrypt_test_nginx () {
|
|||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
letsencrypt_test_nginx --domain nginx.wtf run
|
letsencrypt_test_nginx --domains nginx.wtf run
|
||||||
echo | openssl s_client -connect localhost:5001 \
|
echo | openssl s_client -connect localhost:5001 \
|
||||||
| openssl x509 -out $root/nginx.pem
|
| openssl x509 -out $root/nginx.pem
|
||||||
diff -q $root/nginx.pem $root/conf/live/nginx.wtf/cert.pem
|
diff -q $root/nginx.pem $root/conf/live/nginx.wtf/cert.pem
|
||||||
|
|||||||
+6
-6
@@ -106,7 +106,7 @@ def _find_domains(args, installer):
|
|||||||
domains = args.domains
|
domains = args.domains
|
||||||
|
|
||||||
if not domains:
|
if not domains:
|
||||||
raise errors.Error("Please specify --domain, or --installer that "
|
raise errors.Error("Please specify --domains, or --installer that "
|
||||||
"will help in domain names autodiscovery")
|
"will help in domain names autodiscovery")
|
||||||
|
|
||||||
return domains
|
return domains
|
||||||
@@ -465,9 +465,9 @@ def obtaincert(args, config, plugins):
|
|||||||
"""Authenticate & obtain cert, but do not install it."""
|
"""Authenticate & obtain cert, but do not install it."""
|
||||||
|
|
||||||
if args.domains is not None and args.csr is not None:
|
if args.domains is not None and args.csr is not None:
|
||||||
# TODO: --csr could have a priority, when --domain is
|
# TODO: --csr could have a priority, when --domains is
|
||||||
# supplied, check if CSR matches given domains?
|
# supplied, check if CSR matches given domains?
|
||||||
return "--domain and --csr are mutually exclusive"
|
return "--domains and --csr are mutually exclusive"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# installers are used in auth mode to determine domain names
|
# installers are used in auth mode to determine domain names
|
||||||
@@ -831,11 +831,11 @@ def prepare_and_parse_args(plugins, args):
|
|||||||
None, "-t", "--text", dest="text_mode", action="store_true",
|
None, "-t", "--text", dest="text_mode", action="store_true",
|
||||||
help="Use the text output instead of the curses UI.")
|
help="Use the text output instead of the curses UI.")
|
||||||
helpful.add(None, "-m", "--email", help=config_help("email"))
|
helpful.add(None, "-m", "--email", help=config_help("email"))
|
||||||
# positional arg shadows --domain, instead of appending, and
|
# positional arg shadows --domains, instead of appending, and
|
||||||
# --domain is useful, because it can be stored in config
|
# --domains is useful, because it can be stored in config
|
||||||
#for subparser in parser_run, parser_auth, parser_install:
|
#for subparser in parser_run, parser_auth, parser_install:
|
||||||
# subparser.add_argument("domains", nargs="*", metavar="domain")
|
# subparser.add_argument("domains", nargs="*", metavar="domain")
|
||||||
helpful.add(None, "-d", "--domain", dest="domains",
|
helpful.add(None, "-d", "--domains", dest="domains",
|
||||||
metavar="DOMAIN", action="append",
|
metavar="DOMAIN", action="append",
|
||||||
help="Domain names to apply. For multiple domains you can use "
|
help="Domain names to apply. For multiple domains you can use "
|
||||||
"multiple -d flags or enter a comma separated list of domains"
|
"multiple -d flags or enter a comma separated list of domains"
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class CLITest(unittest.TestCase):
|
|||||||
|
|
||||||
@mock.patch('letsencrypt.cli.display_ops')
|
@mock.patch('letsencrypt.cli.display_ops')
|
||||||
def test_installer_selection(self, mock_display_ops):
|
def test_installer_selection(self, mock_display_ops):
|
||||||
self._call(['install', '--domain', 'foo.bar', '--cert-path', 'cert',
|
self._call(['install', '--domains', 'foo.bar', '--cert-path', 'cert',
|
||||||
'--key-path', 'key', '--chain-path', 'chain'])
|
'--key-path', 'key', '--chain-path', 'chain'])
|
||||||
self.assertEqual(mock_display_ops.pick_installer.call_count, 1)
|
self.assertEqual(mock_display_ops.pick_installer.call_count, 1)
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ class CLITest(unittest.TestCase):
|
|||||||
|
|
||||||
def test_certonly_bad_args(self):
|
def test_certonly_bad_args(self):
|
||||||
ret, _, _, _ = self._call(['-d', 'foo.bar', 'certonly', '--csr', CSR])
|
ret, _, _, _ = self._call(['-d', 'foo.bar', 'certonly', '--csr', CSR])
|
||||||
self.assertEqual(ret, '--domain and --csr are mutually exclusive')
|
self.assertEqual(ret, '--domains and --csr are mutually exclusive')
|
||||||
|
|
||||||
ret, _, _, _ = self._call(['-a', 'bad_auth', 'certonly'])
|
ret, _, _, _ = self._call(['-a', 'bad_auth', 'certonly'])
|
||||||
self.assertEqual(ret, 'The requested bad_auth plugin does not appear to be installed')
|
self.assertEqual(ret, 'The requested bad_auth plugin does not appear to be installed')
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ common() {
|
|||||||
"$@"
|
"$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
common --domain le1.wtf --standalone-supported-challenges tls-sni-01 auth
|
common --domains le1.wtf --standalone-supported-challenges tls-sni-01 auth
|
||||||
common --domain le2.wtf --standalone-supported-challenges http-01 run
|
common --domains le2.wtf --standalone-supported-challenges http-01 run
|
||||||
common -a manual -d le.wtf auth
|
common -a manual -d le.wtf auth
|
||||||
|
|
||||||
export CSR_PATH="${root}/csr.der" KEY_PATH="${root}/key.pem" \
|
export CSR_PATH="${root}/csr.der" KEY_PATH="${root}/key.pem" \
|
||||||
@@ -40,7 +40,7 @@ common auth --csr "$CSR_PATH" \
|
|||||||
openssl x509 -in "${root}/csr/0000_cert.pem" -text
|
openssl x509 -in "${root}/csr/0000_cert.pem" -text
|
||||||
openssl x509 -in "${root}/csr/0000_chain.pem" -text
|
openssl x509 -in "${root}/csr/0000_chain.pem" -text
|
||||||
|
|
||||||
common --domain le3.wtf install \
|
common --domains le3.wtf install \
|
||||||
--cert-path "${root}/csr/cert.pem" \
|
--cert-path "${root}/csr/cert.pem" \
|
||||||
--key-path "${root}/csr/key.pem"
|
--key-path "${root}/csr/key.pem"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user