From f9b8933f37e83fd1ebceebafc6b3ab84dbab4394 Mon Sep 17 00:00:00 2001 From: osirisinferi Date: Fri, 6 Jan 2017 21:58:51 +0100 Subject: [PATCH] Add line number to Augeas syntax error message (#3974) * Add line number to Augeas syntax error message * Use `format()` for message formatting * Pleasing Python 2.6 --- certbot-apache/certbot_apache/augeas_configurator.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/certbot-apache/certbot_apache/augeas_configurator.py b/certbot-apache/certbot_apache/augeas_configurator.py index 6999120d6..3735284ef 100644 --- a/certbot-apache/certbot_apache/augeas_configurator.py +++ b/certbot-apache/certbot_apache/augeas_configurator.py @@ -68,9 +68,12 @@ class AugeasConfigurator(common.Plugin): # As aug.get may return null if lens_path and lens in lens_path: msg = ( - "There has been an error in parsing the file (%s): %s", + "There has been an error in parsing the file {0} on line {1}: " + "{2}".format( # Strip off /augeas/files and /error - path[13:len(path) - 6], self.aug.get(path + "/message")) + path[13:len(path) - 6], + self.aug.get(path + "/line"), + self.aug.get(path + "/message"))) raise errors.PluginError(msg) # TODO: Cleanup this function