def _get_jinja_error(trace, context=None):
 if (not context):
  context = {}
 out = ''
 error = _get_jinja_error_slug(trace)
 line = _get_jinja_error_line(trace)
 msg = _get_jinja_error_message(trace)
 add_log = False
 template_path = None
 if ('sls' not in context):
  if ((error[0] != '<unknown>') and os.path.exists(error[0])):
   template_path = error[0]
   add_log = True
 else:
  filen = context['sls'].replace('.', '/')
  if ((not error[0].endswith(filen)) and os.path.exists(error[0])):
   add_log = True
   template_path = error[0]
 if add_log:
  if template_path:
   out = '\n{0}\n'.format(msg.splitlines()[0])
   with salt.utils.fopen(template_path) as fp_:
    template_contents = fp_.read()
   out += salt.utils.get_context(template_contents, line, marker='    <======================')
  else:
   out = '\n{0}\n'.format(msg)
  line = 0
 return (line, out)

def _get_jinja_error ( trace , context = None ) : if ( not context ) : context = { } out = '' error = _get_jinja_error_slug ( trace ) line = _get_jinja_error_line ( trace ) msg = _get_jinja_error_message ( trace ) add_log = False template_path = None if ( 'sls' not in context ) : if ( ( error [ 0 ] != '<unknown>' ) and os . path . exists ( error [ 0 ] ) ) : template_path = error [ 0 ] add_log = True else : filen = context [ 'sls' ] . replace ( '.' , '/' ) if ( ( not error [ 0 ] . endswith ( filen ) ) and os . path . exists ( error [ 0 ] ) ) : add_log = True template_path = error [ 0 ] if add_log : if template_path : out = '\n{0}\n' . format ( msg . splitlines ( ) [ 0 ] ) with salt . utils . fopen ( template_path ) as fp_ : template_contents = fp_ . read ( ) out += salt . utils . get_context ( template_contents , line , marker = '    <======================' ) else : out = '\n{0}\n' . format ( msg ) line = 0 return ( line , out )
return the error line and error message output from a stacktrace .