From f0cfd69cdcd62f3c9e97f0828357a2c31104e9d4 Mon Sep 17 00:00:00 2001 From: Jacob Hoffman-Andrews Date: Sun, 11 Oct 2015 11:28:39 -0700 Subject: [PATCH] Respond to review feedback. --- letsencrypt-apache/letsencrypt_apache/configurator.py | 2 +- letsencrypt-nginx/letsencrypt_nginx/configurator.py | 8 ++++---- letsencrypt-nginx/letsencrypt_nginx/dvsni.py | 5 ++--- letsencrypt-nginx/letsencrypt_nginx/tests/util.py | 6 ++++-- tests/boulder-start.sh | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/letsencrypt-apache/letsencrypt_apache/configurator.py b/letsencrypt-apache/letsencrypt_apache/configurator.py index a3c2bd186..91aa02aef 100644 --- a/letsencrypt-apache/letsencrypt_apache/configurator.py +++ b/letsencrypt-apache/letsencrypt_apache/configurator.py @@ -164,7 +164,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): 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-nginx/letsencrypt_nginx/configurator.py b/letsencrypt-nginx/letsencrypt_nginx/configurator.py index 426500eb3..8f7431a72 100644 --- a/letsencrypt-nginx/letsencrypt_nginx/configurator.py +++ b/letsencrypt-nginx/letsencrypt_nginx/configurator.py @@ -149,13 +149,13 @@ class NginxConfigurator(common.Plugin): try: self.parser.add_server_directives(vhost.filep, vhost.names, - cert_directives, True) + cert_directives, replace=True) self.parser.add_server_directives(vhost.filep, vhost.names, - stapling_directives, False) + stapling_directives, replace=False) logger.info("Deployed Certificate to VirtualHost %s for %s", vhost.filep, vhost.names) - except errors.MisconfigurationError, e: - logger.debug(e) + except errors.MisconfigurationError as error: + logger.debug(error) logger.warn( "Cannot find a cert or key directive in %s for %s. " "VirtualHost was not modified.", vhost.filep, vhost.names) diff --git a/letsencrypt-nginx/letsencrypt_nginx/dvsni.py b/letsencrypt-nginx/letsencrypt_nginx/dvsni.py index f384082ef..9ac2fcd7c 100644 --- a/letsencrypt-nginx/letsencrypt_nginx/dvsni.py +++ b/letsencrypt-nginx/letsencrypt_nginx/dvsni.py @@ -96,11 +96,10 @@ class NginxDvsni(common.Dvsni): bucket_directive = ['server_names_hash_bucket_size', '128'] main = self.configurator.parser.parsed[root] - for key, value in main: + for key, body in main: if key == ['http']: - body = value found_bucket = False - for key, value in body: # pylint: disable=unused-variable + for key, _ in body: if key == bucket_directive[0]: found_bucket = True if not found_bucket: diff --git a/letsencrypt-nginx/letsencrypt_nginx/tests/util.py b/letsencrypt-nginx/letsencrypt_nginx/tests/util.py index ad4dedfe7..9cfa6a1a1 100644 --- a/letsencrypt-nginx/letsencrypt_nginx/tests/util.py +++ b/letsencrypt-nginx/letsencrypt_nginx/tests/util.py @@ -86,12 +86,14 @@ def filter_comments(tree): return list(traverse(tree)) + def contains_at_depth(haystack, needle, n): - """ + """Is the needle in haystack at depth n? + Return true if the needle is present in one of the sub-iterables in haystack at depth n. Haystack must be an iterable. """ - if not hasattr(haystack, '__iter__'): + if not isinstance(haystack, collections.Iterable): return False if n == 0: return needle in haystack diff --git a/tests/boulder-start.sh b/tests/boulder-start.sh index 8780cac7c..530f9c598 100755 --- a/tests/boulder-start.sh +++ b/tests/boulder-start.sh @@ -38,5 +38,5 @@ if ! go get bitbucket.org/liamstask/goose/cmd/goose ; then exit 1 fi ./test/create_db.sh -./start.py > /dev/null & +./start.py & # Hopefully start.py bootstraps before integration test is started...