Template value of debugger and then check for validity (#53587)

* Template value of debugger and then check for validity

* Removed if/else and forcing failure on undefined as per comments

* Added changelog

* changed colon to brackets so it appears as a string
pull/61401/head
Jack Parsons 5 years ago committed by Matt Martz
parent c1c6e9f008
commit 80b73712a9

@ -0,0 +1,2 @@
minor_changes:
- Allow debugger to take a templated value (https://github.com/ansible/ansible/pull/53587)

@ -254,7 +254,8 @@ class FieldAttributeBase(with_metaclass(BaseMeta, object)):
def get_variable_manager(self):
return self._variable_manager
def _validate_debugger(self, attr, name, value):
def _post_validate_debugger(self, attr, value, templar):
value = templar.template(value)
valid_values = frozenset(('always', 'on_failed', 'on_unreachable', 'on_skipped', 'never'))
if value and isinstance(value, string_types) and value not in valid_values:
raise AnsibleParserError("'%s' is not a valid value for debugger. Must be one of %s" % (value, ', '.join(valid_values)), obj=self.get_ds())

Loading…
Cancel
Save