Use correct action in warning about missing name

This commit is contained in:
Martin Krizek 2018-03-29 13:53:01 +02:00 committed by Brian Coca
parent 5e2f215dd7
commit fd96bcd22f

View file

@ -112,12 +112,12 @@ class IncludeRole(TaskInclude):
# name is needed, or use role as alias # name is needed, or use role as alias
ir._role_name = ir.args.get('name', ir.args.get('role')) ir._role_name = ir.args.get('name', ir.args.get('role'))
if ir._role_name is None: if ir._role_name is None:
raise AnsibleParserError("'name' is a required field for include_role.") raise AnsibleParserError("'name' is a required field for %s." % ir.action)
# validate bad args, otherwise we silently ignore # validate bad args, otherwise we silently ignore
bad_opts = my_arg_names.difference(IncludeRole.VALID_ARGS) bad_opts = my_arg_names.difference(IncludeRole.VALID_ARGS)
if bad_opts: if bad_opts:
raise AnsibleParserError('Invalid options for include_role: %s' % ','.join(list(bad_opts))) raise AnsibleParserError('Invalid options for %s: %s' % (ir.action, ','.join(list(bad_opts))))
# build options for role includes # build options for role includes
for key in my_arg_names.intersection(IncludeRole.FROM_ARGS): for key in my_arg_names.intersection(IncludeRole.FROM_ARGS):