mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
parent
174de1161b
commit
299054852a
2 changed files with 13 additions and 2 deletions
|
@ -82,7 +82,7 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
_poll = FieldAttribute(isa='int')
|
||||
_register = FieldAttribute(isa='string')
|
||||
_retries = FieldAttribute(isa='int', default=3)
|
||||
_until = FieldAttribute(isa='list') # ?
|
||||
_until = FieldAttribute(isa='list')
|
||||
|
||||
def __init__(self, block=None, role=None, task_include=None):
|
||||
''' constructors a task, without the Task.load classmethod, it will be pretty blank '''
|
||||
|
|
|
@ -20,7 +20,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.compat.six.moves import queue as Queue
|
||||
from ansible.compat.six import iteritems, text_type
|
||||
from ansible.compat.six import iteritems, text_type, string_types
|
||||
|
||||
import time
|
||||
|
||||
|
@ -431,6 +431,17 @@ class StrategyBase:
|
|||
# then we create a temporary set of vars to ensure the variable reference is unique
|
||||
temp_vars = b._task_include.vars.copy()
|
||||
temp_vars.update(included_file._args.copy())
|
||||
# pop tags out of the include args, if they were specified there, and assign
|
||||
# them to the include. If the include already had tags specified, we raise an
|
||||
# error so that users know not to specify them both ways
|
||||
tags = temp_vars.pop('tags', [])
|
||||
if isinstance(tags, string_types):
|
||||
tags = [ tags ]
|
||||
if len(tags) > 0:
|
||||
if len(b._task_include.tags) > 0:
|
||||
raise AnsibleParserError("Include tasks should not specify tags in more than one way (both via args and directly on the task)", obj=included_file._task._ds)
|
||||
self._display.deprecated("You should not specify tags in the include parameters. All tags should be specified using the task-level option")
|
||||
b._task_include.tags = tags
|
||||
b._task_include.vars = temp_vars
|
||||
|
||||
return block_list
|
||||
|
|
Loading…
Reference in a new issue