Skip to content

Commit

Permalink
More detailed error logging for nginx plugin (#6175)
Browse files Browse the repository at this point in the history
This makes errors more useful when Nginx can't be found or when Nginx's
configuration can't be found.  Previously, a generic
`NoInstallationError` isn't descriptive enough to explain _what_ wasn't
installed or what failed without going digging into the source code.
  • Loading branch information
davidjb authored and sydneyli committed Sep 12, 2018
1 parent b32ec6e commit 38b1d9d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion certbot-nginx/certbot_nginx/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ def prepare(self):
"""
# Verify Nginx is installed
if not util.exe_exists(self.conf('ctl')):
raise errors.NoInstallationError
raise errors.NoInstallationError(
"Could not find a usable 'nginx' binary. Ensure nginx exists, "
"the binary is executable, and your PATH is set correctly.")

# Make sure configuration is valid
self.config_test()
Expand Down
2 changes: 1 addition & 1 deletion certbot-nginx/certbot_nginx/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _find_config_root(self):
return os.path.join(self.root, name)

raise errors.NoInstallationError(
"Could not find configuration root")
"Could not find Nginx root configuration file (nginx.conf)")

def filedump(self, ext='tmp', lazy=True):
"""Dumps parsed configurations into files.
Expand Down

0 comments on commit 38b1d9d

Please sign in to comment.