diff options
author | James Cammarata <jimi@sngx.net> | 2016-08-10 06:59:30 -0500 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2016-08-10 06:59:30 -0500 |
commit | 138e55919220b000c10a0058864875889e376abf (patch) | |
tree | 60b3e5b35cc71b0f351c910622ddeb348dfbcb6d | |
parent | 7503875ed7156c29d233a2a573ce53dc67b3c035 (diff) | |
download | ansible-issue_17018_block_when_inheritance.tar.gz |
Validate new blocks during copyissue_17018_block_when_inheritance
It is possible that a block is copied prior to validation, in which case
some fields (like when) which should be something other than a string might
not be. Using validate() in copy() is relatively harmless and ensures the
blocks are in the proper structure.
Fixes #17018
-rw-r--r-- | lib/ansible/playbook/base.py | 4 | ||||
-rw-r--r-- | lib/ansible/playbook/block.py | 1 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index ca6ad67c17..6cef5acd53 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -303,9 +303,9 @@ class Base: else: setattr(new_me, name, attr_val) - new_me._loader = self._loader + new_me._loader = self._loader new_me._variable_manager = self._variable_manager - + new_me._finalized = self._finalized new_me._uuid = self._uuid # if the ds value was set on the object, copy it to the new copy too diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py index 493cec2b22..ec6298a2c1 100644 --- a/lib/ansible/playbook/block.py +++ b/lib/ansible/playbook/block.py @@ -192,6 +192,7 @@ class Block(Base, Become, Conditional, Taggable): if self._role: new_me._role = self._role + new_me.validate() return new_me def serialize(self): |