<s> """<STR_LIT>""" <EOL> import sys <EOL> import Bcfg2 . Server . Lint <EOL> from jinja2 import Template , TemplateSyntaxError <EOL> from Bcfg2 . Server . Plugins . Cfg . CfgJinja2Generator import CfgJinja2Generator <EOL> class Jinja2 ( Bcfg2 . Server . Lint . ServerPlugin ) : <EOL> """<STR_LIT>""" <EOL> def Run ( self ) : <EOL> if '<STR_LIT>' in self . core . plugins : <EOL> self . check_cfg ( ) <EOL> @ classmethod <EOL> def Errors ( cls ) : <EOL> return { "<STR_LIT>" : "<STR_LIT:error>" , <EOL> "<STR_LIT>" : "<STR_LIT:error>" } <EOL> def check_template ( self , entry ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> Template ( entry . data . decode ( entry . encoding ) ) <EOL> except TemplateSyntaxError : <EOL> err = sys . exc_info ( ) [ <NUM_LIT:1> ] <EOL> self . LintError ( "<STR_LIT>" , <EOL> "<STR_LIT>" % ( entry . name , err ) ) <EOL> except : <EOL> err = sys . exc_info ( ) [ <NUM_LIT:1> ] <EOL> self . LintError ( "<STR_LIT>" , <EOL> "<STR_LIT>" % ( entry . name , <EOL> err ) ) <EOL> def check_cfg ( self ) : <EOL> """<STR_LIT>""" <EOL> for entryset in self . core . plugins [ '<STR_LIT>' ] . entries . values ( ) : <EOL> for entry in entryset . entries . values ( ) : <EOL> if ( self . HandlesFile ( entry . name ) and <EOL> isinstance ( entry , CfgJinja2Generator ) ) : <EOL> self . check_template ( entry ) </s>
