Guest User

Untitled

a guest
Nov 18th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. diff --git lib/ansible/template/__init__.py lib/ansible/template/__init__.py
  2. index 0894022fbb..d53fd0d672 100644
  3. --- lib/ansible/template/__init__.py
  4. +++ lib/ansible/template/__init__.py
  5. @@ -205,7 +205,7 @@ class AnsibleContext(Context):
  6. self._update_unsafe(val)
  7. return val
  8.  
  9. -
  10. +import sys
  11. class AnsibleEnvironment(Environment):
  12. '''
  13. Our custom environment, which simply allows us to override the class-level
  14. @@ -214,6 +214,19 @@ class AnsibleEnvironment(Environment):
  15. context_class = AnsibleContext
  16. template_class = AnsibleJ2Template
  17.  
  18. + def _compile(self, source, filename):
  19. + # ansible at least seems picky if stdout gets junk, so stderr.
  20. + # of course, logging would be even better
  21. +
  22. + import traceback
  23. + tbl = traceback.format_stack()
  24. + sys.stderr.write('\n')
  25. + sys.stderr.write(''.join(tbl))
  26. + sys.stderr.write('source for %s\n' % filename)
  27. + sys.stderr.write('%s\n\n' % source)
  28. +
  29. + return compile(source, filename, 'exec')
  30. +
Add Comment
Please, Sign In to add comment