Show error details for the nginx config parser (#4221)

Nginx parser errors now include helpful details on where parsing has
actually failed.

Related: https://github.com/certbot/certbot/issues/3798
This commit is contained in:
silverwind
2017-02-22 18:50:56 -08:00
committed by Brad Warren
parent a92ca8e97c
commit b1a4280519
+4 -4
View File
@@ -205,8 +205,8 @@ class NginxParser(object):
trees.append(parsed)
except IOError:
logger.warning("Could not open file: %s", item)
except pyparsing.ParseException:
logger.debug("Could not parse file: %s", item)
except pyparsing.ParseException as err:
logger.debug("Could not parse file: %s due to %s", item, err)
return trees
def _parse_ssl_options(self, ssl_options):
@@ -216,8 +216,8 @@ class NginxParser(object):
return nginxparser.load(_file).spaced
except IOError:
logger.warn("Missing NGINX TLS options file: %s", ssl_options)
except pyparsing.ParseBaseException:
logger.debug("Could not parse file: %s", ssl_options)
except pyparsing.ParseBaseException as err:
logger.debug("Could not parse file: %s due to %s", ssl_options, err)
return []
def _set_locations(self, ssl_options):