mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 20:12:42 +02:00
Use logger.warning instead of deprecated warn
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ class Fixed(jose.Field):
|
|||||||
|
|
||||||
def encode(self, value):
|
def encode(self, value):
|
||||||
if value != self.value:
|
if value != self.value:
|
||||||
logger.warn(
|
logger.warning(
|
||||||
'Overriding fixed field (%s) with %r', self.json_name, value)
|
'Overriding fixed field (%s) with %r', self.json_name, value)
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
|
|
||||||
if not path["cert_path"] or not path["cert_key"]:
|
if not path["cert_path"] or not path["cert_key"]:
|
||||||
# Throw some can't find all of the directives error"
|
# Throw some can't find all of the directives error"
|
||||||
logger.warn(
|
logger.warning(
|
||||||
"Cannot find a cert or key directive in %s. "
|
"Cannot find a cert or key directive in %s. "
|
||||||
"VirtualHost was not modified", vhost.path)
|
"VirtualHost was not modified", vhost.path)
|
||||||
# Presumably break here so that the virtualhost is not modified
|
# Presumably break here so that the virtualhost is not modified
|
||||||
@@ -522,7 +522,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
try:
|
try:
|
||||||
args = self.aug.match(path + "/arg")
|
args = self.aug.match(path + "/arg")
|
||||||
except RuntimeError:
|
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
|
return None
|
||||||
for arg in args:
|
for arg in args:
|
||||||
addrs.add(obj.Addr.fromstring(self.parser.get_arg(arg)))
|
addrs.add(obj.Addr.fromstring(self.parser.get_arg(arg)))
|
||||||
@@ -1089,7 +1089,7 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
|
|||||||
try:
|
try:
|
||||||
func(self.choose_vhost(domain), options)
|
func(self.choose_vhost(domain), options)
|
||||||
except errors.PluginError:
|
except errors.PluginError:
|
||||||
logger.warn("Failed %s for %s", enhancement, domain)
|
logger.warning("Failed %s for %s", enhancement, domain)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def _enable_ocsp_stapling(self, ssl_vhost, unused_options):
|
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
|
# but redirect loops are possible in very obscure cases; see #1620
|
||||||
# for reasoning.
|
# for reasoning.
|
||||||
if self._is_rewrite_exists(general_vh):
|
if self._is_rewrite_exists(general_vh):
|
||||||
logger.warn("Added an HTTP->HTTPS rewrite in addition to "
|
logger.warning("Added an HTTP->HTTPS rewrite in addition to "
|
||||||
"other RewriteRules; you may wish to check for "
|
"other RewriteRules; you may wish to check for "
|
||||||
"overall consistency.")
|
"overall consistency.")
|
||||||
|
|
||||||
# Add directives to server
|
# Add directives to server
|
||||||
# Note: These are not immediately searchable in sites-enabled
|
# Note: These are not immediately searchable in sites-enabled
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ def _vhost_menu(domain, vhosts):
|
|||||||
"non-interactive mode. Currently Certbot needs each vhost to be "
|
"non-interactive mode. Currently Certbot needs each vhost to be "
|
||||||
"in its own conf file, and may need vhosts to be explicitly "
|
"in its own conf file, and may need vhosts to be explicitly "
|
||||||
"labelled with ServerName or ServerAlias directories.")
|
"labelled with ServerName or ServerAlias directories.")
|
||||||
logger.warn(msg)
|
logger.warning(msg)
|
||||||
raise errors.MissingCommandlineFlag(msg)
|
raise errors.MissingCommandlineFlag(msg)
|
||||||
|
|
||||||
return code, tag
|
return code, tag
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ class ApacheParser(object):
|
|||||||
constants.os_constant("define_cmd"))
|
constants.os_constant("define_cmd"))
|
||||||
# Small errors that do not impede
|
# Small errors that do not impede
|
||||||
if proc.returncode != 0:
|
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(
|
raise errors.MisconfigurationError(
|
||||||
"Apache is unable to check whether or not the module is "
|
"Apache is unable to check whether or not the module is "
|
||||||
"loaded because Apache is misconfigured.")
|
"loaded because Apache is misconfigured.")
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class ApacheTlsSni01(common.TLSSNI01):
|
|||||||
# because it's a new vhost that's not configured yet (GH #677),
|
# because it's a new vhost that's not configured yet (GH #677),
|
||||||
# or perhaps because there were multiple <VirtualHost> sections
|
# or perhaps because there were multiple <VirtualHost> sections
|
||||||
# in the config file (GH #1042). See also GH #2600.
|
# 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)
|
addrs.add(default_addr)
|
||||||
return addrs
|
return addrs
|
||||||
|
|
||||||
|
|||||||
@@ -369,10 +369,10 @@ def main():
|
|||||||
plugin.cleanup_from_tests()
|
plugin.cleanup_from_tests()
|
||||||
|
|
||||||
if overall_success:
|
if overall_success:
|
||||||
logger.warn("All compatibility tests succeeded")
|
logger.warning("All compatibility tests succeeded")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
logger.warn("One or more compatibility tests failed")
|
logger.warning("One or more compatibility tests failed")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ class NginxConfigurator(common.Plugin):
|
|||||||
vhost.filep, vhost.names)
|
vhost.filep, vhost.names)
|
||||||
except errors.MisconfigurationError as error:
|
except errors.MisconfigurationError as error:
|
||||||
logger.debug(error)
|
logger.debug(error)
|
||||||
logger.warn(
|
logger.warning(
|
||||||
"Cannot find a cert or key directive in %s for %s. "
|
"Cannot find a cert or key directive in %s for %s. "
|
||||||
"VirtualHost was not modified.", vhost.filep, vhost.names)
|
"VirtualHost was not modified.", vhost.filep, vhost.names)
|
||||||
# Presumably break here so that the virtualhost is not modified
|
# Presumably break here so that the virtualhost is not modified
|
||||||
@@ -385,7 +385,7 @@ class NginxConfigurator(common.Plugin):
|
|||||||
raise errors.PluginError(
|
raise errors.PluginError(
|
||||||
"Unsupported enhancement: {0}".format(enhancement))
|
"Unsupported enhancement: {0}".format(enhancement))
|
||||||
except errors.PluginError:
|
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):
|
def _enable_redirect(self, vhost, unused_options):
|
||||||
"""Redirect all equivalent HTTP traffic to ssl_vhost.
|
"""Redirect all equivalent HTTP traffic to ssl_vhost.
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ class NginxParser(object):
|
|||||||
self.parsed[item] = parsed
|
self.parsed[item] = parsed
|
||||||
trees.append(parsed)
|
trees.append(parsed)
|
||||||
except IOError:
|
except IOError:
|
||||||
logger.warn("Could not open file: %s", item)
|
logger.warning("Could not open file: %s", item)
|
||||||
except pyparsing.ParseException:
|
except pyparsing.ParseException:
|
||||||
logger.debug("Could not parse file: %s", item)
|
logger.debug("Could not parse file: %s", item)
|
||||||
return trees
|
return trees
|
||||||
|
|||||||
+1
-1
@@ -158,7 +158,7 @@ def possible_deprecation_warning(config):
|
|||||||
# need warnings
|
# need warnings
|
||||||
return
|
return
|
||||||
if "CERTBOT_AUTO" not in os.environ:
|
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. "
|
"not receive updates, and is less reliable than more recent versions. "
|
||||||
"We recommend upgrading to the latest certbot-auto script, or using native "
|
"We recommend upgrading to the latest certbot-auto script, or using native "
|
||||||
"OS packages.")
|
"OS packages.")
|
||||||
|
|||||||
+4
-4
@@ -104,10 +104,10 @@ def register(config, account_storage, tos_cb=None):
|
|||||||
if not config.register_unsafely_without_email:
|
if not config.register_unsafely_without_email:
|
||||||
msg = ("No email was provided and "
|
msg = ("No email was provided and "
|
||||||
"--register-unsafely-without-email was not present.")
|
"--register-unsafely-without-email was not present.")
|
||||||
logger.warn(msg)
|
logger.warning(msg)
|
||||||
raise errors.Error(msg)
|
raise errors.Error(msg)
|
||||||
if not config.dry_run:
|
if not config.dry_run:
|
||||||
logger.warn("Registering without email!")
|
logger.warning("Registering without email!")
|
||||||
|
|
||||||
# Each new registration shall use a fresh new key
|
# Each new registration shall use a fresh new key
|
||||||
key = jose.JWKRSA(key=jose.ComparableRSAKey(
|
key = jose.JWKRSA(key=jose.ComparableRSAKey(
|
||||||
@@ -453,10 +453,10 @@ class Client(object):
|
|||||||
try:
|
try:
|
||||||
self.installer.enhance(dom, enhancement, options)
|
self.installer.enhance(dom, enhancement, options)
|
||||||
except errors.PluginEnhancementAlreadyPresent:
|
except errors.PluginEnhancementAlreadyPresent:
|
||||||
logger.warn("Enhancement %s was already set.",
|
logger.warning("Enhancement %s was already set.",
|
||||||
enhancement)
|
enhancement)
|
||||||
except errors.PluginError:
|
except errors.PluginError:
|
||||||
logger.warn("Unable to set enhancement %s for %s",
|
logger.warning("Unable to set enhancement %s for %s",
|
||||||
enhancement, dom)
|
enhancement, dom)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -53,7 +53,7 @@ def post_hook(config, final=False):
|
|||||||
if not pre_hook.already:
|
if not pre_hook.already:
|
||||||
logger.info("No renewals attempted, so not running post-hook")
|
logger.info("No renewals attempted, so not running post-hook")
|
||||||
if config.verb != "renew":
|
if config.verb != "renew":
|
||||||
logger.warn("Sanity failure in renewal hooks")
|
logger.warning("Sanity failure in renewal hooks")
|
||||||
return
|
return
|
||||||
if final or config.verb != "renew":
|
if final or config.verb != "renew":
|
||||||
logger.info("Running post-hook command: %s", config.post_hook)
|
logger.info("Running post-hook command: %s", config.post_hook)
|
||||||
|
|||||||
+1
-1
@@ -773,5 +773,5 @@ def main(cli_args=sys.argv[1:]):
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
err_string = main()
|
err_string = main()
|
||||||
if err_string:
|
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
|
sys.exit(err_string) # pragma: no cover
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ def choose_configurator_plugins(config, plugins, verb):
|
|||||||
if verb == "install":
|
if verb == "install":
|
||||||
need_inst = True
|
need_inst = True
|
||||||
if config.authenticator:
|
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
|
# Try to meet the user's request and/or ask them to pick plugins
|
||||||
authenticator = installer = None
|
authenticator = installer = None
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ def path_surgery(restart_cmd):
|
|||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
expanded = " expanded" if any(added) 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
|
return False
|
||||||
|
|
||||||
def already_listening(port, renewer=False):
|
def already_listening(port, renewer=False):
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import psutil
|
|||||||
class PathSurgeryTest(unittest.TestCase):
|
class PathSurgeryTest(unittest.TestCase):
|
||||||
"""Tests for certbot.plugins.path_surgery."""
|
"""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")
|
@mock.patch("certbot.plugins.util.logger.debug")
|
||||||
def test_path_surgery(self, mock_debug, mock_warn):
|
def test_path_surgery(self, mock_debug, mock_warn):
|
||||||
from certbot.plugins.util import path_surgery
|
from certbot.plugins.util import path_surgery
|
||||||
|
|||||||
+1
-1
@@ -552,7 +552,7 @@ class Reverter(object):
|
|||||||
others.sort()
|
others.sort()
|
||||||
if others[-1] != timestamp:
|
if others[-1] != timestamp:
|
||||||
timetravel = str(float(others[-1]) + 1)
|
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",
|
"checkpoint; your clock probably jumped. Time travelling to %s",
|
||||||
timestamp, timetravel)
|
timestamp, timetravel)
|
||||||
timestamp = timetravel
|
timestamp = timetravel
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class RegisterTest(unittest.TestCase):
|
|||||||
self.config.register_unsafely_without_email = True
|
self.config.register_unsafely_without_email = True
|
||||||
self.config.dry_run = False
|
self.config.dry_run = False
|
||||||
self._call()
|
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):
|
def test_unsupported_error(self):
|
||||||
from acme import messages
|
from acme import messages
|
||||||
|
|||||||
+1
-1
@@ -349,7 +349,7 @@ def safe_email(email):
|
|||||||
if EMAIL_REGEX.match(email) is not None:
|
if EMAIL_REGEX.match(email) is not None:
|
||||||
return not email.startswith(".") and ".." not in email
|
return not email.startswith(".") and ".." not in email
|
||||||
else:
|
else:
|
||||||
logger.warn("Invalid email address: %s.", email)
|
logger.warning("Invalid email address: %s.", email)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user