More detailed error logging for nginx plugin (#6175)

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.
This commit is contained in:
David Beitey
2018-09-12 16:48:50 -07:00
committed by sydneyli
parent b32ec6ed30
commit 38b1d9d6ba
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -136,7 +136,9 @@ class NginxConfigurator(common.Installer):
"""
# 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()
+1 -1
View File
@@ -222,7 +222,7 @@ class NginxParser(object):
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.