mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:41:53 +02:00
Improve error message
This commit is contained in:
+8
-7
@@ -36,9 +36,10 @@ from certbot.plugins import disco as plugins_disco
|
|||||||
from certbot.plugins import selection as plug_sel
|
from certbot.plugins import selection as plug_sel
|
||||||
|
|
||||||
|
|
||||||
_PERM_ERR_FMT = ("An error occurred while trying to create or modify {0}. To "
|
_PERM_ERR_FMT = os.linesep.join((
|
||||||
"run as non-root, set --config-dir, --logs-dir, and "
|
"The following error was encountered:", "{0}",
|
||||||
"--work-dir to writeable paths.")
|
"If running as non-root, set --config-dir, "
|
||||||
|
"--logs-dir, and --work-dir to writeable paths."))
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -601,8 +602,8 @@ def setup_log_file_handler(config, logfile, fmt):
|
|||||||
try:
|
try:
|
||||||
handler = logging.handlers.RotatingFileHandler(
|
handler = logging.handlers.RotatingFileHandler(
|
||||||
log_file_path, maxBytes=2 ** 20, backupCount=10)
|
log_file_path, maxBytes=2 ** 20, backupCount=10)
|
||||||
except IOError:
|
except IOError as error:
|
||||||
raise errors.Error(_PERM_ERR_FMT.format(log_file_path))
|
raise errors.Error(_PERM_ERR_FMT.format(error))
|
||||||
# rotate on each invocation, rollover only possible when maxBytes
|
# rotate on each invocation, rollover only possible when maxBytes
|
||||||
# is nonzero and backupCount is nonzero, so we set maxBytes as big
|
# is nonzero and backupCount is nonzero, so we set maxBytes as big
|
||||||
# as possible not to overrun in single CLI invocation (1MB).
|
# as possible not to overrun in single CLI invocation (1MB).
|
||||||
@@ -715,8 +716,8 @@ def make_or_verify_core_dir(directory, mode, uid, strict):
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
util.make_or_verify_dir(directory, mode, uid, strict)
|
util.make_or_verify_dir(directory, mode, uid, strict)
|
||||||
except OSError:
|
except OSError as error:
|
||||||
raise errors.Error(_PERM_ERR_FMT.format(directory))
|
raise errors.Error(_PERM_ERR_FMT.format(error))
|
||||||
|
|
||||||
|
|
||||||
def main(cli_args=sys.argv[1:]):
|
def main(cli_args=sys.argv[1:]):
|
||||||
|
|||||||
Reference in New Issue
Block a user