From 5ec34f65d977b653ce04dfac76e6178af3ef2bb4 Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Mon, 7 May 2018 11:25:28 -0500 Subject: [PATCH] Pass obj=data to AnsibleParserError for context in IncludeRole. Fixes #31374 (#39805) --- lib/ansible/playbook/role_include.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/playbook/role_include.py b/lib/ansible/playbook/role_include.py index 2b95deb6502..9e09186bdbc 100644 --- a/lib/ansible/playbook/role_include.py +++ b/lib/ansible/playbook/role_include.py @@ -112,12 +112,12 @@ class IncludeRole(TaskInclude): # name is needed, or use role as alias ir._role_name = ir.args.get('name', ir.args.get('role')) if ir._role_name is None: - raise AnsibleParserError("'name' is a required field for %s." % ir.action) + raise AnsibleParserError("'name' is a required field for %s." % ir.action, obj=data) # validate bad args, otherwise we silently ignore bad_opts = my_arg_names.difference(IncludeRole.VALID_ARGS) if bad_opts: - raise AnsibleParserError('Invalid options for %s: %s' % (ir.action, ','.join(list(bad_opts)))) + raise AnsibleParserError('Invalid options for %s: %s' % (ir.action, ','.join(list(bad_opts))), obj=data) # build options for role includes for key in my_arg_names.intersection(IncludeRole.FROM_ARGS):