template.py: Handle purposely raised exceptions in lookup()

If a lookup plugin is run by the lookup() template method it should pass
along any AnsibleError (or child exception classes) rather than just eat
them.  These exceptions are purposely raised by the plugin.
pull/4420/head
Jack Neely 2014-05-30 16:41:20 -04:00
parent 7da68bb27c
commit 2fda9bc743
1 changed files with 3 additions and 0 deletions

View File

@ -91,6 +91,9 @@ def lookup(name, *args, **kwargs):
# safely catch run failures per #5059 # safely catch run failures per #5059
try: try:
ran = instance.run(*args, inject=vars, **kwargs) ran = instance.run(*args, inject=vars, **kwargs)
except errors.AnsibleError:
# Plugin raised this on purpose
raise
except Exception, e: except Exception, e:
ran = None ran = None
if ran: if ran: