From 7ba35b44075579b9274486982b92c93b58f5094d Mon Sep 17 00:00:00 2001 From: Brad Warren Date: Tue, 17 Nov 2020 11:51:27 -0800 Subject: [PATCH 1/2] import print_function --- certbot-ci/certbot_integration_tests/utils/dns_server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/certbot-ci/certbot_integration_tests/utils/dns_server.py b/certbot-ci/certbot_integration_tests/utils/dns_server.py index b6b922f6d..3d2f50d3b 100644 --- a/certbot-ci/certbot_integration_tests/utils/dns_server.py +++ b/certbot-ci/certbot_integration_tests/utils/dns_server.py @@ -1,5 +1,7 @@ #!/usr/bin/env python """Module to setup an RFC2136-capable DNS server""" +from __future__ import print_function + import os import os.path from pkg_resources import resource_filename From e8139e80be54fe478fce28321a8d7f15c5182673 Mon Sep 17 00:00:00 2001 From: Alex Zorin Date: Wed, 18 Nov 2020 09:51:42 +1100 Subject: [PATCH 2/2] certbot-ci: fix py2 crash in dns_server --- .../utils/dns_server.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/certbot-ci/certbot_integration_tests/utils/dns_server.py b/certbot-ci/certbot_integration_tests/utils/dns_server.py index 3d2f50d3b..779d736e3 100644 --- a/certbot-ci/certbot_integration_tests/utils/dns_server.py +++ b/certbot-ci/certbot_integration_tests/utils/dns_server.py @@ -40,6 +40,8 @@ class DNSServer(object): self.bind_root = tempfile.mkdtemp() + self.process = None + self.dns_xdist = { 'address': BIND_BIND_ADDRESS[0], 'port': BIND_BIND_ADDRESS[1] @@ -60,11 +62,12 @@ class DNSServer(object): def stop(self): """Stop the DNS server, and clean its resources""" - try: - self.process.terminate() - self.process.wait() - except BaseException as e: - print("BIND9 did not stop cleanly: {}".format(e), file=sys.stderr) + if self.process: + try: + self.process.terminate() + self.process.wait() + except BaseException as e: + print("BIND9 did not stop cleanly: {}".format(e), file=sys.stderr) shutil.rmtree(self.bind_root, ignore_errors=True) @@ -74,7 +77,8 @@ class DNSServer(object): def _configure_bind(self): """Configure the BIND9 server based on the prebaked configuration""" bind_conf_src = resource_filename('certbot_integration_tests', 'assets/bind-config') - shutil.copytree(bind_conf_src, self.bind_root, dirs_exist_ok=True) + for dir in ('conf', 'zones'): + shutil.copytree(os.path.join(bind_conf_src, dir), os.path.join(self.bind_root, dir)) def _start_bind(self): """Launch the BIND9 server as a Docker container"""