From 7cf835059e325b4c8bfa5d36837e36429340461c Mon Sep 17 00:00:00 2001 From: Alex Zorin Date: Thu, 22 Apr 2021 17:44:16 +1000 Subject: [PATCH] catch up to python3 changes --- certbot-apache/certbot_apache/_internal/configurator.py | 8 +++----- certbot-apache/tests/centos6_test.py | 8 +------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/certbot-apache/certbot_apache/_internal/configurator.py b/certbot-apache/certbot_apache/_internal/configurator.py index c31faa2fa..e97d9d81f 100644 --- a/certbot-apache/certbot_apache/_internal/configurator.py +++ b/certbot-apache/certbot_apache/_internal/configurator.py @@ -556,8 +556,7 @@ class ApacheConfigurator(common.Installer): return list(matched) - def _raise_no_suitable_vhost_error(self, target_name): - # type: (str) -> None + def _raise_no_suitable_vhost_error(self, target_name: str): """ Notifies the user that Certbot could not find a vhost to secure and raises an error. @@ -1540,10 +1539,9 @@ class ApacheConfigurator(common.Installer): if sift: display_util.notify( - "Some rewrite rules copied from {src_path} were disabled in the " - "vhost for your HTTPS site located at {dest_path} because they have " + f"Some rewrite rules copied from {vhost.filep} were disabled in the " + f"vhost for your HTTPS site located at {ssl_fp} because they have " "the potential to create redirection loops." - .format(src_path=vhost.filep, dest_path=ssl_fp) ) self.parser.aug.set("/augeas/files%s/mtime" % (self._escape(ssl_fp)), "0") self.parser.aug.set("/augeas/files%s/mtime" % (self._escape(vhost.filep)), "0") diff --git a/certbot-apache/tests/centos6_test.py b/certbot-apache/tests/centos6_test.py index 3c0bbb913..017e2f09f 100644 --- a/certbot-apache/tests/centos6_test.py +++ b/certbot-apache/tests/centos6_test.py @@ -1,11 +1,6 @@ """Test for certbot_apache._internal.configurator for CentOS 6 overrides""" import unittest - -try: - import mock -except ImportError: # pragma: no cover - from unittest import mock # type: ignore -import six # pylint: disable=unused-import # six is used in mock.patch() +from unittest import mock from certbot.compat import os from certbot.errors import MisconfigurationError @@ -15,7 +10,6 @@ from certbot_apache._internal import parser import util - def get_vh_truth(temp_dir, config_name): """Return the ground truth for the specified directory.""" prefix = os.path.join(