diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-11-26 10:59:49 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-11-26 10:59:49 -0500 |
commit | d32fd476787eddc8921eeadbfba5fa7e601ca231 (patch) | |
tree | 446ba62d159ed1d30316b95dba99c836b48d2ce0 /src | |
parent | 1275ae79e555dbb81eeb90275350694445fa04c2 (diff) | |
download | bcfg2-d32fd476787eddc8921eeadbfba5fa7e601ca231.tar.gz bcfg2-d32fd476787eddc8921eeadbfba5fa7e601ca231.tar.bz2 bcfg2-d32fd476787eddc8921eeadbfba5fa7e601ca231.zip |
avoid odd edge case in genshi error handling
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py index 48f64ac7f..3a78b4847 100644 --- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgGenshiGenerator.py @@ -137,9 +137,13 @@ class CfgGenshiGenerator(CfgGenerator): # single line break) real_lineno = lineno - contents.code.co_firstlineno src = re.sub(r'\n\n+', '\n', contents.source).splitlines() - raise PluginExecutionError("%s: %s at '%s'" % - (err.__class__.__name__, err, - src[real_lineno])) + try: + raise PluginExecutionError("%s: %s at '%s'" % + (err.__class__.__name__, err, + src[real_lineno])) + except IndexError: + raise PluginExecutionError("%s: %s" % + (err.__class__.__name__, err)) raise def handle_event(self, event): |