@ -31,7 +31,7 @@ from ansible.compat.six import iteritems, string_types
from jinja2 . exceptions import UndefinedError
from jinja2 . exceptions import UndefinedError
from ansible . errors import AnsibleParserError
from ansible . errors import AnsibleParserError , AnsibleUndefinedVariable
from ansible . parsing . dataloader import DataLoader
from ansible . parsing . dataloader import DataLoader
from ansible . playbook . attribute import Attribute , FieldAttribute
from ansible . playbook . attribute import Attribute , FieldAttribute
from ansible . utils . boolean import boolean
from ansible . utils . boolean import boolean
@ -406,7 +406,7 @@ class Base:
except ( TypeError , ValueError ) as e :
except ( TypeError , ValueError ) as e :
raise AnsibleParserError ( " the field ' %s ' has an invalid value ( %s ), and could not be converted to an %s . "
raise AnsibleParserError ( " the field ' %s ' has an invalid value ( %s ), and could not be converted to an %s . "
" Error was: %s " % ( name , value , attribute . isa , e ) , obj = self . get_ds ( ) )
" Error was: %s " % ( name , value , attribute . isa , e ) , obj = self . get_ds ( ) )
except UndefinedError as e :
except ( AnsibleUndefinedVariable , UndefinedError ) as e :
if templar . _fail_on_undefined_errors and name != ' name ' :
if templar . _fail_on_undefined_errors and name != ' name ' :
raise AnsibleParserError ( " the field ' %s ' has an invalid value, which appears to include a variable that is undefined. "
raise AnsibleParserError ( " the field ' %s ' has an invalid value, which appears to include a variable that is undefined. "
" The error was: %s " % ( name , e ) , obj = self . get_ds ( ) )
" The error was: %s " % ( name , e ) , obj = self . get_ds ( ) )