diff --git a/acme/acme/fields.py b/acme/acme/fields.py index 002240b23..12d09acf4 100644 --- a/acme/acme/fields.py +++ b/acme/acme/fields.py @@ -24,7 +24,7 @@ class Fixed(jose.Field): def encode(self, value): if value != self.value: - logger.warn( + logger.warning( 'Overriding fixed field (%s) with %r', self.json_name, value) return value diff --git a/certbot-apache/certbot_apache/configurator.py b/certbot-apache/certbot_apache/configurator.py index e61a9f2e6..238255133 100644 --- a/certbot-apache/certbot_apache/configurator.py +++ b/certbot-apache/certbot_apache/configurator.py @@ -244,7 +244,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): if not path["cert_path"] or not path["cert_key"]: # Throw some can't find all of the directives error" - logger.warn( + logger.warning( "Cannot find a cert or key directive in %s. " "VirtualHost was not modified", vhost.path) # Presumably break here so that the virtualhost is not modified @@ -522,7 +522,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): try: args = self.aug.match(path + "/arg") except RuntimeError: - logger.warn("Encountered a problem while parsing file: %s, skipping", path) + logger.warning("Encountered a problem while parsing file: %s, skipping", path) return None for arg in args: addrs.add(obj.Addr.fromstring(self.parser.get_arg(arg))) @@ -1089,7 +1089,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): try: func(self.choose_vhost(domain), options) except errors.PluginError: - logger.warn("Failed %s for %s", enhancement, domain) + logger.warning("Failed %s for %s", enhancement, domain) raise def _enable_ocsp_stapling(self, ssl_vhost, unused_options): @@ -1276,9 +1276,9 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator): # but redirect loops are possible in very obscure cases; see #1620 # for reasoning. if self._is_rewrite_exists(general_vh): - logger.warn("Added an HTTP->HTTPS rewrite in addition to " - "other RewriteRules; you may wish to check for " - "overall consistency.") + logger.warning("Added an HTTP->HTTPS rewrite in addition to " + "other RewriteRules; you may wish to check for " + "overall consistency.") # Add directives to server # Note: These are not immediately searchable in sites-enabled diff --git a/certbot-apache/certbot_apache/display_ops.py b/certbot-apache/certbot_apache/display_ops.py index 24aabaed4..d7b76f83d 100644 --- a/certbot-apache/certbot_apache/display_ops.py +++ b/certbot-apache/certbot_apache/display_ops.py @@ -91,7 +91,7 @@ def _vhost_menu(domain, vhosts): "non-interactive mode. Currently Certbot needs each vhost to be " "in its own conf file, and may need vhosts to be explicitly " "labelled with ServerName or ServerAlias directories.") - logger.warn(msg) + logger.warning(msg) raise errors.MissingCommandlineFlag(msg) return code, tag diff --git a/certbot-apache/certbot_apache/parser.py b/certbot-apache/certbot_apache/parser.py index 321546eb3..6bb6ff170 100644 --- a/certbot-apache/certbot_apache/parser.py +++ b/certbot-apache/certbot_apache/parser.py @@ -146,7 +146,7 @@ class ApacheParser(object): constants.os_constant("define_cmd")) # Small errors that do not impede if proc.returncode != 0: - logger.warn("Error in checking parameter list: %s", stderr) + logger.warning("Error in checking parameter list: %s", stderr) raise errors.MisconfigurationError( "Apache is unable to check whether or not the module is " "loaded because Apache is misconfigured.") diff --git a/certbot-apache/certbot_apache/tests/configurator_test.py b/certbot-apache/certbot_apache/tests/configurator_test.py index 0bbdac1aa..ac692ae54 100644 --- a/certbot-apache/certbot_apache/tests/configurator_test.py +++ b/certbot-apache/certbot_apache/tests/configurator_test.py @@ -56,7 +56,7 @@ class MultipleVhostsTest(util.ApacheTest): mock_surgery.return_value = False with mock.patch.dict('os.environ', silly_path): self.assertRaises(errors.NoInstallationError, self.config.prepare) - self.assertEquals(mock_surgery.call_count, 1) + self.assertEqual(mock_surgery.call_count, 1) @mock.patch("certbot_apache.augeas_configurator.AugeasConfigurator.init_augeas") def test_prepare_no_augeas(self, mock_init_augeas): @@ -1242,8 +1242,8 @@ class MultipleVhostsTest(util.ApacheTest): mock_match = mock.Mock(return_value=["something"]) self.config.aug.match = mock_match # pylint: disable=protected-access - self.assertEquals(self.config._check_aug_version(), - ["something"]) + self.assertEqual(self.config._check_aug_version(), + ["something"]) self.config.aug.match.side_effect = RuntimeError self.assertFalse(self.config._check_aug_version()) diff --git a/certbot-apache/certbot_apache/tls_sni_01.py b/certbot-apache/certbot_apache/tls_sni_01.py index 06d9e9ebd..18179d080 100644 --- a/certbot-apache/certbot_apache/tls_sni_01.py +++ b/certbot-apache/certbot_apache/tls_sni_01.py @@ -129,7 +129,7 @@ class ApacheTlsSni01(common.TLSSNI01): # because it's a new vhost that's not configured yet (GH #677), # or perhaps because there were multiple sections # in the config file (GH #1042). See also GH #2600. - logger.warn("Falling back to default vhost %s...", default_addr) + logger.warning("Falling back to default vhost %s...", default_addr) addrs.add(default_addr) return addrs diff --git a/certbot-compatibility-test/certbot_compatibility_test/test_driver.py b/certbot-compatibility-test/certbot_compatibility_test/test_driver.py index 38abffb18..2c78eea1f 100644 --- a/certbot-compatibility-test/certbot_compatibility_test/test_driver.py +++ b/certbot-compatibility-test/certbot_compatibility_test/test_driver.py @@ -369,10 +369,10 @@ def main(): plugin.cleanup_from_tests() if overall_success: - logger.warn("All compatibility tests succeeded") + logger.warning("All compatibility tests succeeded") sys.exit(0) else: - logger.warn("One or more compatibility tests failed") + logger.warning("One or more compatibility tests failed") sys.exit(1) diff --git a/certbot-nginx/certbot_nginx/configurator.py b/certbot-nginx/certbot_nginx/configurator.py index d11b6bb14..8157e48f1 100644 --- a/certbot-nginx/certbot_nginx/configurator.py +++ b/certbot-nginx/certbot_nginx/configurator.py @@ -179,7 +179,7 @@ class NginxConfigurator(common.Plugin): vhost.filep, vhost.names) except errors.MisconfigurationError as error: logger.debug(error) - logger.warn( + logger.warning( "Cannot find a cert or key directive in %s for %s. " "VirtualHost was not modified.", vhost.filep, vhost.names) # Presumably break here so that the virtualhost is not modified @@ -385,7 +385,7 @@ class NginxConfigurator(common.Plugin): raise errors.PluginError( "Unsupported enhancement: {0}".format(enhancement)) except errors.PluginError: - logger.warn("Failed %s for %s", enhancement, domain) + logger.warning("Failed %s for %s", enhancement, domain) def _enable_redirect(self, vhost, unused_options): """Redirect all equivalent HTTP traffic to ssl_vhost. diff --git a/certbot-nginx/certbot_nginx/parser.py b/certbot-nginx/certbot_nginx/parser.py index e7992810a..aae6ce122 100644 --- a/certbot-nginx/certbot_nginx/parser.py +++ b/certbot-nginx/certbot_nginx/parser.py @@ -168,7 +168,7 @@ class NginxParser(object): self.parsed[item] = parsed trees.append(parsed) except IOError: - logger.warn("Could not open file: %s", item) + logger.warning("Could not open file: %s", item) except pyparsing.ParseException: logger.debug("Could not parse file: %s", item) return trees diff --git a/certbot-nginx/certbot_nginx/tests/configurator_test.py b/certbot-nginx/certbot_nginx/tests/configurator_test.py index 7529bc10b..fa130fc4e 100644 --- a/certbot-nginx/certbot_nginx/tests/configurator_test.py +++ b/certbot-nginx/certbot_nginx/tests/configurator_test.py @@ -37,8 +37,8 @@ class NginxConfiguratorTest(util.NginxTest): errors.NoInstallationError, self.config.prepare) def test_prepare(self): - self.assertEquals((1, 6, 2), self.config.version) - self.assertEquals(5, len(self.config.parser.parsed)) + self.assertEqual((1, 6, 2), self.config.version) + self.assertEqual(5, len(self.config.parser.parsed)) @mock.patch("certbot_nginx.configurator.util.exe_exists") @mock.patch("certbot_nginx.configurator.subprocess.Popen") @@ -56,7 +56,7 @@ class NginxConfiguratorTest(util.NginxTest): self.config.version = None self.config.config_test = mock.Mock() self.config.prepare() - self.assertEquals((1, 6, 2), self.config.version) + self.assertEqual((1, 6, 2), self.config.version) @mock.patch("certbot_nginx.configurator.socket.gethostbyaddr") def test_get_all_names(self, mock_gethostbyaddr): diff --git a/certbot-nginx/certbot_nginx/tests/nginxparser_test.py b/certbot-nginx/certbot_nginx/tests/nginxparser_test.py index a0a0736a5..5fa9a7d1e 100644 --- a/certbot-nginx/certbot_nginx/tests/nginxparser_test.py +++ b/certbot-nginx/certbot_nginx/tests/nginxparser_test.py @@ -134,8 +134,8 @@ class TestRawNginxParser(unittest.TestCase): parsed_new = load(handle) try: self.maxDiff = None - self.assertEquals(parsed[0], parsed_new[0]) - self.assertEquals(parsed[1:], parsed_new[1:]) + self.assertEqual(parsed[0], parsed_new[0]) + self.assertEqual(parsed[1:], parsed_new[1:]) finally: os.unlink(util.get_data_filename('nginx.new.conf')) @@ -150,7 +150,7 @@ class TestRawNginxParser(unittest.TestCase): parsed_new = load(handle) try: - self.assertEquals(parsed, parsed_new) + self.assertEqual(parsed, parsed_new) self.assertEqual(parsed_new, [ ['#', " Use bar.conf when it's a full moon!"], diff --git a/certbot-nginx/certbot_nginx/tests/parser_test.py b/certbot-nginx/certbot_nginx/tests/parser_test.py index 464d717ed..77b4a877a 100644 --- a/certbot-nginx/certbot_nginx/tests/parser_test.py +++ b/certbot-nginx/certbot_nginx/tests/parser_test.py @@ -117,9 +117,9 @@ class NginxParserTest(util.NginxTest): fooconf = [x for x in vhosts if 'foo.conf' in x.filep][0] self.assertEqual(vhost5, fooconf) localhost = [x for x in vhosts if 'localhost' in x.names][0] - self.assertEquals(vhost1, localhost) + self.assertEqual(vhost1, localhost) somename = [x for x in vhosts if 'somename' in x.names][0] - self.assertEquals(vhost2, somename) + self.assertEqual(vhost2, somename) def test_add_server_directives(self): nparser = parser.NginxParser(self.config_path, self.ssl_options) diff --git a/certbot/cli.py b/certbot/cli.py index d353f5402..5813af730 100644 --- a/certbot/cli.py +++ b/certbot/cli.py @@ -158,7 +158,7 @@ def possible_deprecation_warning(config): # need warnings return if "CERTBOT_AUTO" not in os.environ: - logger.warn("You are running with an old copy of letsencrypt-auto that does " + logger.warning("You are running with an old copy of letsencrypt-auto that does " "not receive updates, and is less reliable than more recent versions. " "We recommend upgrading to the latest certbot-auto script, or using native " "OS packages.") diff --git a/certbot/client.py b/certbot/client.py index 81b7ccdc6..0f414b474 100644 --- a/certbot/client.py +++ b/certbot/client.py @@ -104,10 +104,10 @@ def register(config, account_storage, tos_cb=None): if not config.register_unsafely_without_email: msg = ("No email was provided and " "--register-unsafely-without-email was not present.") - logger.warn(msg) + logger.warning(msg) raise errors.Error(msg) if not config.dry_run: - logger.warn("Registering without email!") + logger.warning("Registering without email!") # Each new registration shall use a fresh new key key = jose.JWKRSA(key=jose.ComparableRSAKey( @@ -453,10 +453,10 @@ class Client(object): try: self.installer.enhance(dom, enhancement, options) except errors.PluginEnhancementAlreadyPresent: - logger.warn("Enhancement %s was already set.", + logger.warning("Enhancement %s was already set.", enhancement) except errors.PluginError: - logger.warn("Unable to set enhancement %s for %s", + logger.warning("Unable to set enhancement %s for %s", enhancement, dom) raise diff --git a/certbot/hooks.py b/certbot/hooks.py index 1a3e4a98e..f37f81c6e 100644 --- a/certbot/hooks.py +++ b/certbot/hooks.py @@ -53,7 +53,7 @@ def post_hook(config, final=False): if not pre_hook.already: logger.info("No renewals attempted, so not running post-hook") if config.verb != "renew": - logger.warn("Sanity failure in renewal hooks") + logger.warning("Sanity failure in renewal hooks") return if final or config.verb != "renew": logger.info("Running post-hook command: %s", config.post_hook) diff --git a/certbot/main.py b/certbot/main.py index 8bccc524d..511046df0 100644 --- a/certbot/main.py +++ b/certbot/main.py @@ -773,5 +773,5 @@ def main(cli_args=sys.argv[1:]): if __name__ == "__main__": err_string = main() if err_string: - logger.warn("Exiting with message %s", err_string) + logger.warning("Exiting with message %s", err_string) sys.exit(err_string) # pragma: no cover diff --git a/certbot/plugins/selection.py b/certbot/plugins/selection.py index 1d7fa323f..21ebe9029 100644 --- a/certbot/plugins/selection.py +++ b/certbot/plugins/selection.py @@ -174,7 +174,7 @@ def choose_configurator_plugins(config, plugins, verb): if verb == "install": need_inst = True if config.authenticator: - logger.warn("Specifying an authenticator doesn't make sense in install mode") + logger.warning("Specifying an authenticator doesn't make sense in install mode") # Try to meet the user's request and/or ask them to pick plugins authenticator = installer = None diff --git a/certbot/plugins/util.py b/certbot/plugins/util.py index cdba88a87..76372154c 100644 --- a/certbot/plugins/util.py +++ b/certbot/plugins/util.py @@ -38,7 +38,7 @@ def path_surgery(restart_cmd): return True else: expanded = " expanded" if any(added) else "" - logger.warn("Failed to find %s in%s PATH: %s", restart_cmd, expanded, path) + logger.warning("Failed to find %s in%s PATH: %s", restart_cmd, expanded, path) return False def already_listening(port, renewer=False): diff --git a/certbot/plugins/util_test.py b/certbot/plugins/util_test.py index fa8b364d9..6ba5e8bcf 100644 --- a/certbot/plugins/util_test.py +++ b/certbot/plugins/util_test.py @@ -8,7 +8,7 @@ import psutil class PathSurgeryTest(unittest.TestCase): """Tests for certbot.plugins.path_surgery.""" - @mock.patch("certbot.plugins.util.logger.warn") + @mock.patch("certbot.plugins.util.logger.warning") @mock.patch("certbot.plugins.util.logger.debug") def test_path_surgery(self, mock_debug, mock_warn): from certbot.plugins.util import path_surgery @@ -16,15 +16,15 @@ class PathSurgeryTest(unittest.TestCase): with mock.patch.dict('os.environ', all_path): with mock.patch('certbot.util.exe_exists') as mock_exists: mock_exists.return_value = True - self.assertEquals(path_surgery("eg"), True) - self.assertEquals(mock_debug.call_count, 0) - self.assertEquals(mock_warn.call_count, 0) - self.assertEquals(os.environ["PATH"], all_path["PATH"]) + self.assertEqual(path_surgery("eg"), True) + self.assertEqual(mock_debug.call_count, 0) + self.assertEqual(mock_warn.call_count, 0) + self.assertEqual(os.environ["PATH"], all_path["PATH"]) no_path = {"PATH": "/tmp/"} with mock.patch.dict('os.environ', no_path): path_surgery("thingy") - self.assertEquals(mock_debug.call_count, 1) - self.assertEquals(mock_warn.call_count, 1) + self.assertEqual(mock_debug.call_count, 1) + self.assertEqual(mock_warn.call_count, 1) self.assertTrue("Failed to find" in mock_warn.call_args[0][0]) self.assertTrue("/usr/local/bin" in os.environ["PATH"]) self.assertTrue("/tmp" in os.environ["PATH"]) diff --git a/certbot/reverter.py b/certbot/reverter.py index 6dde05077..1c404e29b 100644 --- a/certbot/reverter.py +++ b/certbot/reverter.py @@ -552,7 +552,7 @@ class Reverter(object): others.sort() if others[-1] != timestamp: timetravel = str(float(others[-1]) + 1) - logger.warn("Current timestamp %s does not correspond to newest reverter " + logger.warning("Current timestamp %s does not correspond to newest reverter " "checkpoint; your clock probably jumped. Time travelling to %s", timestamp, timetravel) timestamp = timetravel diff --git a/certbot/tests/client_test.py b/certbot/tests/client_test.py index 9156277a9..e7ae6bbd1 100644 --- a/certbot/tests/client_test.py +++ b/certbot/tests/client_test.py @@ -82,7 +82,7 @@ class RegisterTest(unittest.TestCase): self.config.register_unsafely_without_email = True self.config.dry_run = False self._call() - mock_logger.warn.assert_called_once_with(mock.ANY) + mock_logger.warning.assert_called_once_with(mock.ANY) def test_unsupported_error(self): from acme import messages diff --git a/certbot/tests/reverter_test.py b/certbot/tests/reverter_test.py index 58cc68dce..450cecacf 100644 --- a/certbot/tests/reverter_test.py +++ b/certbot/tests/reverter_test.py @@ -362,8 +362,8 @@ class TestFullCheckpointsReverter(unittest.TestCase): self.assertEqual(mock_logger.warning.call_count, 1) # Test Generic warning - mock_logger.warning.call_count = 0 self._setup_three_checkpoints() + mock_logger.warning.call_count = 0 self.reverter.rollback_checkpoints(4) self.assertEqual(mock_logger.warning.call_count, 1) diff --git a/certbot/util.py b/certbot/util.py index 2b40a0f2c..65aae59e2 100644 --- a/certbot/util.py +++ b/certbot/util.py @@ -349,7 +349,7 @@ def safe_email(email): if EMAIL_REGEX.match(email) is not None: return not email.startswith(".") and ".." not in email else: - logger.warn("Invalid email address: %s.", email) + logger.warning("Invalid email address: %s.", email) return False