mirror of
https://github.com/certbot/certbot.git
synced 2026-01-13 10:22:20 +03:00
lineage_for_certname should return None if there is no existing renewal file (#4243)
* lineage_for_certname should return None if there is no existing renewal file * add unit test * add regression test to integration test * revent boulder-start to boulder-fetch
This commit is contained in:
committed by
Brad Warren
parent
b1a4280519
commit
52ce335ff0
@@ -100,7 +100,10 @@ def lineage_for_certname(cli_config, certname):
|
||||
configs_dir = cli_config.renewal_configs_dir
|
||||
# Verify the directory is there
|
||||
util.make_or_verify_dir(configs_dir, mode=0o755, uid=os.geteuid())
|
||||
renewal_file = storage.renewal_file_for_certname(cli_config, certname)
|
||||
try:
|
||||
renewal_file = storage.renewal_file_for_certname(cli_config, certname)
|
||||
except errors.CertStorageError:
|
||||
return None
|
||||
try:
|
||||
return storage.RenewableCert(renewal_file, cli_config)
|
||||
except (errors.CertStorageError, IOError):
|
||||
|
||||
@@ -290,6 +290,16 @@ class LineageForCertnameTest(BaseCertManagerTest):
|
||||
None)
|
||||
self.assertTrue(mock_make_or_verify_dir.called)
|
||||
|
||||
@mock.patch('certbot.util.make_or_verify_dir')
|
||||
@mock.patch('certbot.storage.renewal_file_for_certname')
|
||||
def test_no_renewal_file(self, mock_renewal_conf_file,
|
||||
mock_make_or_verify_dir):
|
||||
mock_renewal_conf_file.side_effect = errors.CertStorageError()
|
||||
from certbot import cert_manager
|
||||
self.assertEqual(cert_manager.lineage_for_certname(self.cli_config, "example.com"),
|
||||
None)
|
||||
self.assertTrue(mock_make_or_verify_dir.called)
|
||||
|
||||
|
||||
class DomainsForCertnameTest(BaseCertManagerTest):
|
||||
"""Tests for certbot.cert_manager.domains_for_certname"""
|
||||
|
||||
@@ -100,6 +100,8 @@ common certonly -a manual -d le.wtf --rsa-key-size 4096 \
|
||||
common certonly -a manual -d dns.le.wtf --preferred-challenges dns,tls-sni \
|
||||
--manual-auth-hook ./tests/manual-dns-auth.sh
|
||||
|
||||
common certonly --cert-name newname -d newname.le.wtf
|
||||
|
||||
export CSR_PATH="${root}/csr.der" KEY_PATH="${root}/key.pem" \
|
||||
OPENSSL_CNF=examples/openssl.cnf
|
||||
./examples/generate-csr.sh le3.wtf
|
||||
|
||||
Reference in New Issue
Block a user