Validate that rescue and always have an accompanying block. Fixes #26751 (#41822)

pull/41859/head
Matt Martz 6 years ago committed by GitHub
parent e9a5c53512
commit 9a18385fab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -161,6 +161,12 @@ class Block(Base, Become, Conditional, Taggable):
except AssertionError as e:
raise AnsibleParserError("A malformed block was encountered while loading always", obj=self._ds, orig_exc=e)
def _validate_always(self, attr, name, value):
if value and not self.block:
raise AnsibleParserError("'%s' keyword cannot be used without 'block'" % name, obj=self._ds)
_validate_rescue = _validate_always
def get_dep_chain(self):
if self._dep_chain is None:
if self._parent:

Loading…
Cancel
Save