1
0
mirror of https://github.com/certbot/certbot.git synced 2026-01-26 07:41:33 +03:00

Remove legacy get_all_certs_and_keys() method

This commit is contained in:
Brad Warren
2017-08-24 09:04:57 -07:00
parent b342f40c2b
commit 90ffe2aac0
2 changed files with 0 additions and 37 deletions

View File

@@ -317,30 +317,6 @@ class Installer(plugins_common.Plugin):
:rtype: :class:`list` of :class:`str`
"""
def get_all_certs_keys(self):
"""Retrieve all certs and keys set in configuration.
:returns: tuples with form `[(cert, key, path)]`, where:
- `cert` - str path to certificate file
- `key` - str path to associated key file
- `path` - file path to configuration file
:rtype: list
"""
cert_materials = {'smtpd_tls_key_file': None,
'smtpd_tls_cert_file': None,
}
for num, line in enumerate(self.cf):
num, found_var, found_value = parse_line((num, line))
if found_var in cert_materials.keys():
cert_materials[found_var] = found_value
if not all(cert_materials.values()):
cert_material_tuples = []
else:
cert_material_tuples = [(cert_materials['smtpd_tls_cert_file'],
cert_materials['smtpd_tls_key_file'],
self.fn),]
return cert_material_tuples
def save(self, title=None, temporary=False):
"""Saves all changes to the configuration files.
Both title and temporary are needed because a save may be

View File

@@ -80,19 +80,6 @@ class InstallerTest(certbot_test_util.TempDirTestCase):
installer = self._create_prepared_installer()
self.assertEqual(sorted_names, installer.get_all_names())
def test_get_all_certs_and_keys(self):
return_vals = [('/etc/letsencrypt/live/www.fubard.org/fullchain.pem',
'/etc/letsencrypt/live/www.fubard.org/privkey.pem',
os.path.join(self.tempdir, 'main.cf')),]
self._write_config(certs_only_config)
installer = self._create_prepared_installer()
self.assertEqual(return_vals, installer.get_all_certs_keys())
def test_get_all_certs_and_keys_with_none(self):
self._write_config(names_only_config)
installer = self._create_prepared_installer()
self.assertEqual([], installer.get_all_certs_keys())
def _write_config(self, content):
config_dir = self.config.postfix_config_dir
with open(os.path.join(config_dir, "main.cf"), "w") as f: