|
|
@ -254,15 +254,17 @@ class Base:
|
|
|
|
raise AnsibleParserError("the field '%s' is required but was not set" % name)
|
|
|
|
raise AnsibleParserError("the field '%s' is required but was not set" % name)
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# if the attribute contains a variable, template it now
|
|
|
|
# Run the post-validator if present. These methods are responsible for
|
|
|
|
value = templar.template(getattr(self, name))
|
|
|
|
# using the given templar to template the values, if required.
|
|
|
|
|
|
|
|
|
|
|
|
# run the post-validator if present
|
|
|
|
|
|
|
|
method = getattr(self, '_post_validate_%s' % name, None)
|
|
|
|
method = getattr(self, '_post_validate_%s' % name, None)
|
|
|
|
if method:
|
|
|
|
if method:
|
|
|
|
value = method(attribute, value, all_vars, templar._fail_on_undefined_errors)
|
|
|
|
value = method(attribute, getattr(self, name), templar)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
# otherwise, just make sure the attribute is of the type it should be
|
|
|
|
# if the attribute contains a variable, template it now
|
|
|
|
|
|
|
|
value = templar.template(getattr(self, name))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# and make sure the attribute is of the type it should be
|
|
|
|
|
|
|
|
if value is not None:
|
|
|
|
if attribute.isa == 'string':
|
|
|
|
if attribute.isa == 'string':
|
|
|
|
value = unicode(value)
|
|
|
|
value = unicode(value)
|
|
|
|
elif attribute.isa == 'int':
|
|
|
|
elif attribute.isa == 'int':
|
|
|
|