Skip to content

Commit

Permalink
Merge pull request #9682 from ryanpetrello/custom-cred-open-ssh-newline
Browse files Browse the repository at this point in the history
fix a bug that improperly formats OpenSSH keys in custom credential types

cc @ghjm
see: #9361

Reviewed-by: Jake McDermott <yo@jakemcdermott.me>
  • Loading branch information
softwarefactory-project-zuul[bot] authored Mar 24, 2021
2 parents 23d72a9 + 48f4e6d commit 41e2920
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 41e2920

Please sign in to comment.