Make ./pep8.travis.sh run cleanly

98% whitespace.
This commit is contained in:
Sharif Nassar
2015-10-20 22:24:58 -07:00
parent 2cab4e577e
commit 424f4f08b9
6 changed files with 29 additions and 23 deletions
@@ -165,7 +165,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
temp_install(self.mod_ssl_conf) temp_install(self.mod_ssl_conf)
def deploy_cert(self, domain, cert_path, key_path, 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. """Deploys certificate to specified virtual host.
Currently tries to find the last directives to deploy the cert in Currently tries to find the last directives to deploy the cert in
@@ -176,7 +176,7 @@ class Proxy(configurators_common.Proxy):
return {"example.com"} return {"example.com"}
def deploy_cert(self, domain, cert_path, key_path, chain_path=None, def deploy_cert(self, domain, cert_path, key_path, chain_path=None,
fullchain_path=None): fullchain_path=None):
"""Installs cert""" """Installs cert"""
cert_path, key_path, chain_path = self.copy_certs_and_keys( cert_path, key_path, chain_path = self.copy_certs_and_keys(
cert_path, key_path, chain_path) cert_path, key_path, chain_path)
@@ -119,7 +119,7 @@ class NginxConfigurator(common.Plugin):
# Entry point in main.py for installing cert # Entry point in main.py for installing cert
def deploy_cert(self, domain, cert_path, key_path, def deploy_cert(self, domain, cert_path, key_path,
chain_path, fullchain_path): chain_path, fullchain_path):
# pylint: disable=unused-argument # pylint: disable=unused-argument
"""Deploys certificate to specified virtual host. """Deploys certificate to specified virtual host.
@@ -112,11 +112,11 @@ class NginxConfiguratorTest(util.NginxTest):
generated_conf = self.config.parser.parsed[example_conf] generated_conf = self.config.parser.parsed[example_conf]
self.assertTrue(util.contains_at_depth(generated_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, 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, 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): def test_deploy_cert(self):
server_conf = self.config.parser.abs_path('server.conf') server_conf = self.config.parser.abs_path('server.conf')
@@ -165,19 +165,20 @@ class NginxConfiguratorTest(util.NginxTest):
self.assertEqual([['server_name', 'somename alias another.alias']], self.assertEqual([['server_name', 'somename alias another.alias']],
parsed_server_conf) parsed_server_conf)
self.assertTrue(util.contains_at_depth(parsed_nginx_conf, self.assertTrue(util.contains_at_depth(parsed_nginx_conf,
[['server'], [['server'],
[['include', self.config.parser.loc["ssl_options"]], [['include', self.config.parser.loc["ssl_options"]],
['ssl_certificate_key', '/etc/nginx/key.pem'], ['ssl_certificate_key', '/etc/nginx/key.pem'],
['ssl_certificate', '/etc/nginx/fullchain.pem'], ['ssl_certificate', '/etc/nginx/fullchain.pem'],
['error_log', error_log], ['error_log', error_log],
['access_log', access_log], ['access_log', access_log],
['listen', '5001 ssl'], ['listen', '5001 ssl'],
['listen', '8000'], ['listen', '8000'],
['listen', 'somename:8080'], ['listen', 'somename:8080'],
['include', 'server.conf'], ['include', 'server.conf'],
[['location', '/'], [['location', '/'],
[['root', 'html'], ['index', 'index.html index.htm']]]]], [['root', 'html'],
2)) ['index', 'index.html index.htm']]]]],
2))
def test_get_all_certs_keys(self): def test_get_all_certs_keys(self):
nginx_conf = self.config.parser.abs_path('nginx.conf') nginx_conf = self.config.parser.abs_path('nginx.conf')
+6 -4
View File
@@ -93,7 +93,7 @@ def _find_domains(args, installer):
if not domains: if not domains:
raise Error("Please specify --domains, or --installer that " raise Error("Please specify --domains, or --installer that "
"will help in domain names autodiscovery") "will help in domain names autodiscovery")
return domains return domains
@@ -308,6 +308,7 @@ def _auth_from_domains(le_client, config, domains, plugins):
return lineage return lineage
def set_configurator(previously, now): def set_configurator(previously, now):
""" """
Setting configurators multiple ways is okay, as long as they all agree Setting configurators multiple ways is okay, as long as they all agree
@@ -319,10 +320,11 @@ def set_configurator(previously, now):
return previously return previously
if previously: if previously:
if previously != now: if previously != now:
msg = "Too many flags setting configurators/installers/authenticators %s -> %s" msg = "Too many flags setting configurators/installers/authenticators {0} -> {1}"
raise PluginSelectionError, msg % (`previously`, `now`) raise PluginSelectionError(msg.format(repr(previously), repr(now)))
return now return now
def diagnose_configurator_problem(cfg_type, requested, plugins): def diagnose_configurator_problem(cfg_type, requested, plugins):
""" """
Raise the most helpful error message about a plugin being unavailable 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') '"letsencrypt-auto auth" to get a cert you can install manually')
else: else:
msg = "{0} could not be determined or is not installed".format(cfg_type) 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): def choose_configurator_plugins(args, config, plugins, verb):
+3
View File
@@ -24,6 +24,7 @@ class SubprocessError(Error):
class CertStorageError(Error): class CertStorageError(Error):
"""Generic `.CertStorage` error.""" """Generic `.CertStorage` error."""
# Auth Handler Errors # Auth Handler Errors
class AuthorizationError(Error): class AuthorizationError(Error):
"""Authorization error.""" """Authorization error."""
@@ -64,9 +65,11 @@ class DvsniError(DvAuthError):
class PluginError(Error): class PluginError(Error):
"""Let's Encrypt Plugin error.""" """Let's Encrypt Plugin error."""
class PluginSelectionError(Error): class PluginSelectionError(Error):
"""A problem with plugin/configurator selection or setup""" """A problem with plugin/configurator selection or setup"""
class NoInstallationError(PluginError): class NoInstallationError(PluginError):
"""Let's Encrypt No Installation error.""" """Let's Encrypt No Installation error."""