enforce True or False for boolean credential injectors

see: https://github.com/ansible/tower/issues/2038
This commit is contained in:
Ryan Petrello
2018-06-13 16:37:39 -04:00
parent 2a983e3dec
commit 0bcbccba33
3 changed files with 49 additions and 14 deletions

View File

@@ -623,6 +623,11 @@ class CredentialType(CommonModelNameNotUnique):
if len(value):
namespace[field_name] = value
# default missing boolean fields to False
for field in self.inputs.get('fields', []):
if field['type'] == 'boolean' and field['id'] not in credential.inputs.keys():
namespace[field['id']] = safe_namespace[field['id']] = False
file_tmpls = self.injectors.get('file', {})
# If any file templates are provided, render the files and update the
# special `tower` template namespace so the filename can be