Skip to content

Commit

Permalink
fix a bug that improperly formats OpenSSH keys in custom credential t…
Browse files Browse the repository at this point in the history
…ypes
  • Loading branch information
ryanpetrello committed Mar 24, 2021
1 parent 634d432 commit 48f4e6d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion awx/main/models/credential/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,14 @@ class TowerNamespace:
if len(value):
namespace[field_name] = value

# default missing boolean fields to False
for field in self.inputs.get('fields', []):
# default missing boolean fields to False
if field['type'] == 'boolean' and field['id'] not in credential.inputs.keys():
namespace[field['id']] = safe_namespace[field['id']] = False
# make sure private keys end with a \n
if field.get('format') == 'ssh_private_key':
if field['id'] in namespace and not namespace[field['id']].endswith('\n'):
namespace[field['id']] += '\n'

file_tmpls = self.injectors.get('file', {})
# If any file templates are provided, render the files and update the
Expand Down

0 comments on commit 48f4e6d

Please sign in to comment.