From 424f4f08b950037b112cd186cfe11e38ecf4a162 Mon Sep 17 00:00:00 2001 From: Sharif Nassar Date: Tue, 20 Oct 2015 22:24:58 -0700 Subject: [PATCH] Make ./pep8.travis.sh run cleanly 98% whitespace. --- .../letsencrypt_apache/configurator.py | 2 +- .../configurators/apache/common.py | 2 +- .../letsencrypt_nginx/configurator.py | 2 +- .../tests/configurator_test.py | 33 ++++++++++--------- letsencrypt/cli.py | 10 +++--- letsencrypt/errors.py | 3 ++ 6 files changed, 29 insertions(+), 23 deletions(-) diff --git a/letsencrypt-apache/letsencrypt_apache/configurator.py b/letsencrypt-apache/letsencrypt_apache/configurator.py index de69af91cc6..d376fe4b631 100644 --- a/letsencrypt-apache/letsencrypt_apache/configurator.py +++ b/letsencrypt-apache/letsencrypt_apache/configurator.py @@ -165,7 +165,7 @@ def prepare(self): temp_install(self.mod_ssl_conf) def deploy_cert(self, domain, cert_path, key_path, - chain_path=None, fullchain_path=None): # pylint: disable=unused-argument + chain_path=None, fullchain_path=None): # pylint: disable=unused-argument """Deploys certificate to specified virtual host. Currently tries to find the last directives to deploy the cert in diff --git a/letsencrypt-compatibility-test/letsencrypt_compatibility_test/configurators/apache/common.py b/letsencrypt-compatibility-test/letsencrypt_compatibility_test/configurators/apache/common.py index 5f183b6119f..5fef8c47f22 100644 --- a/letsencrypt-compatibility-test/letsencrypt_compatibility_test/configurators/apache/common.py +++ b/letsencrypt-compatibility-test/letsencrypt_compatibility_test/configurators/apache/common.py @@ -176,7 +176,7 @@ def get_testable_domain_names(self): return {"example.com"} def deploy_cert(self, domain, cert_path, key_path, chain_path=None, - fullchain_path=None): + fullchain_path=None): """Installs cert""" cert_path, key_path, chain_path = self.copy_certs_and_keys( cert_path, key_path, chain_path) diff --git a/letsencrypt-nginx/letsencrypt_nginx/configurator.py b/letsencrypt-nginx/letsencrypt_nginx/configurator.py index d1ab8f3d13c..29e69e498ae 100644 --- a/letsencrypt-nginx/letsencrypt_nginx/configurator.py +++ b/letsencrypt-nginx/letsencrypt_nginx/configurator.py @@ -119,7 +119,7 @@ def prepare(self): # Entry point in main.py for installing cert def deploy_cert(self, domain, cert_path, key_path, - chain_path, fullchain_path): + chain_path, fullchain_path): # pylint: disable=unused-argument """Deploys certificate to specified virtual host. diff --git a/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py b/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py index 203f9920c00..d8bdf835502 100644 --- a/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py +++ b/letsencrypt-nginx/letsencrypt_nginx/tests/configurator_test.py @@ -112,11 +112,11 @@ def test_deploy_cert_stapling(self): generated_conf = self.config.parser.parsed[example_conf] self.assertTrue(util.contains_at_depth(generated_conf, - ['ssl_stapling', 'on'], 2)) + ['ssl_stapling', 'on'], 2)) self.assertTrue(util.contains_at_depth(generated_conf, - ['ssl_stapling_verify', 'on'], 2)) + ['ssl_stapling_verify', 'on'], 2)) self.assertTrue(util.contains_at_depth(generated_conf, - ['ssl_trusted_certificate', 'example/chain.pem'], 2)) + ['ssl_trusted_certificate', 'example/chain.pem'], 2)) def test_deploy_cert(self): server_conf = self.config.parser.abs_path('server.conf') @@ -165,19 +165,20 @@ def test_deploy_cert(self): self.assertEqual([['server_name', 'somename alias another.alias']], parsed_server_conf) self.assertTrue(util.contains_at_depth(parsed_nginx_conf, - [['server'], - [['include', self.config.parser.loc["ssl_options"]], - ['ssl_certificate_key', '/etc/nginx/key.pem'], - ['ssl_certificate', '/etc/nginx/fullchain.pem'], - ['error_log', error_log], - ['access_log', access_log], - ['listen', '5001 ssl'], - ['listen', '8000'], - ['listen', 'somename:8080'], - ['include', 'server.conf'], - [['location', '/'], - [['root', 'html'], ['index', 'index.html index.htm']]]]], - 2)) + [['server'], + [['include', self.config.parser.loc["ssl_options"]], + ['ssl_certificate_key', '/etc/nginx/key.pem'], + ['ssl_certificate', '/etc/nginx/fullchain.pem'], + ['error_log', error_log], + ['access_log', access_log], + ['listen', '5001 ssl'], + ['listen', '8000'], + ['listen', 'somename:8080'], + ['include', 'server.conf'], + [['location', '/'], + [['root', 'html'], + ['index', 'index.html index.htm']]]]], + 2)) def test_get_all_certs_keys(self): nginx_conf = self.config.parser.abs_path('nginx.conf') diff --git a/letsencrypt/cli.py b/letsencrypt/cli.py index 3af8de2a2ca..1b396b0b8c1 100644 --- a/letsencrypt/cli.py +++ b/letsencrypt/cli.py @@ -93,7 +93,7 @@ def _find_domains(args, installer): if not domains: raise Error("Please specify --domains, or --installer that " - "will help in domain names autodiscovery") + "will help in domain names autodiscovery") return domains @@ -308,6 +308,7 @@ def _auth_from_domains(le_client, config, domains, plugins): return lineage + def set_configurator(previously, now): """ Setting configurators multiple ways is okay, as long as they all agree @@ -319,10 +320,11 @@ def set_configurator(previously, now): return previously if previously: if previously != now: - msg = "Too many flags setting configurators/installers/authenticators %s -> %s" - raise PluginSelectionError, msg % (`previously`, `now`) + msg = "Too many flags setting configurators/installers/authenticators {0} -> {1}" + raise PluginSelectionError(msg.format(repr(previously), repr(now))) return now + def diagnose_configurator_problem(cfg_type, requested, plugins): """ Raise the most helpful error message about a plugin being unavailable @@ -351,7 +353,7 @@ def diagnose_configurator_problem(cfg_type, requested, plugins): '"letsencrypt-auto auth" to get a cert you can install manually') else: msg = "{0} could not be determined or is not installed".format(cfg_type) - raise PluginSelectionError, msg + raise PluginSelectionError(msg) def choose_configurator_plugins(args, config, plugins, verb): diff --git a/letsencrypt/errors.py b/letsencrypt/errors.py index 406b9c12c60..3bfed4d23aa 100644 --- a/letsencrypt/errors.py +++ b/letsencrypt/errors.py @@ -24,6 +24,7 @@ class SubprocessError(Error): class CertStorageError(Error): """Generic `.CertStorage` error.""" + # Auth Handler Errors class AuthorizationError(Error): """Authorization error.""" @@ -64,9 +65,11 @@ class DvsniError(DvAuthError): class PluginError(Error): """Let's Encrypt Plugin error.""" + class PluginSelectionError(Error): """A problem with plugin/configurator selection or setup""" + class NoInstallationError(PluginError): """Let's Encrypt No Installation error."""