diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index e95e16b518..d54ebafb24 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -312,12 +312,7 @@ class Base(with_metaclass(BaseMeta, object)): ''' if not self._squashed: for name in self._valid_attrs.keys(): - getter = partial(_generic_g, name) - setter = partial(_generic_s, name) - deleter = partial(_generic_d, name) - self._attributes[name] = getattr(self, name) - #print("squashed attr %s: %s" % (name, self._attributes[name])) self._squashed = True def copy(self): @@ -516,7 +511,9 @@ class Base(with_metaclass(BaseMeta, object)): repr[name] = getattr(self, name) # serialize the uuid field - repr['uuid'] = getattr(self, '_uuid') + repr['uuid'] = self._uuid + repr['finalized'] = self._finalized + repr['squashed'] = self._squashed return repr @@ -538,4 +535,6 @@ class Base(with_metaclass(BaseMeta, object)): # restore the UUID field setattr(self, '_uuid', data.get('uuid')) + self._finalized = data.get('finalized', False) + self._squashed = data.get('squashed', False) diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index e99f84c108..f5bd653314 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -342,12 +342,13 @@ class Task(Base, Conditional, Taggable, Become): def serialize(self): data = super(Task, self).serialize() - if self._parent: - data['parent'] = self._parent.serialize() - data['parent_type'] = self._parent.__class__.__name__ + if not self._squashed and not self._finalized: + if self._parent: + data['parent'] = self._parent.serialize() + data['parent_type'] = self._parent.__class__.__name__ - if self._role: - data['role'] = self._role.serialize() + if self._role: + data['role'] = self._role.serialize() return data