Skip to content

Commit

Permalink
Don't make system_tags a FieldAttribute
Browse files Browse the repository at this point in the history
ci_complete
  • Loading branch information
s-hertel committed Jun 24, 2020
1 parent 96791b0 commit dd42b41
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/ansible/playbook/play.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,14 @@ def compile(self):
# task, so we can be sure to run handlers at certain points
# of the playbook execution
flush_block = Block.load(
data={'meta': 'flush_handlers', 'tags': ['always'], 'system_tags': True},
data={'meta': 'flush_handlers', 'tags': ['always']},
play=self,
variable_manager=self._variable_manager,
loader=self._loader
)
for task in flush_block.block:
# Since the 'always' tag isn't user-specified here we don't want to display it via --list-tags
task.system_tags = True

block_list = []

Expand Down
11 changes: 10 additions & 1 deletion lib/ansible/playbook/taggable.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ class Taggable:

untagged = frozenset(['untagged'])
_tags = FieldAttribute(isa='list', default=list, listof=(string_types, int), extend=True)
_system_tags = FieldAttribute(isa='bool', default=False)

@property
def system_tags(self):
if not hasattr(self, '_system_tags'):
self._system_tags = False
return self._system_tags

@system_tags.setter
def system_tags(self, value):
self._system_tags = value

def _load_tags(self, attr, ds):
if isinstance(ds, list):
Expand Down
7 changes: 7 additions & 0 deletions lib/ansible/playbook/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ def copy(self, exclude_parent=False, exclude_tasks=False):
if self._role:
new_me._role = self._role

new_me.system_tags = self.system_tags

return new_me

def serialize(self):
Expand All @@ -427,6 +429,9 @@ def serialize(self):
if self._ansible_internal_redirect_list:
data['_ansible_internal_redirect_list'] = self._ansible_internal_redirect_list[:]

if self.system_tags:
data['system_tags'] = self.system_tags

return data

def deserialize(self, data):
Expand Down Expand Up @@ -457,6 +462,8 @@ def deserialize(self, data):

self._ansible_internal_redirect_list = data.get('_ansible_internal_redirect_list', [])

self.system_tags = data.get('system_tags', False)

super(Task, self).deserialize(data)

def set_loader(self, loader):
Expand Down

0 comments on commit dd42b41

Please sign in to comment.