Merge pull request #5383 from ryanpetrello/fix-5311

don't allow private key passphrases for unencrypted private ssh keys
This commit is contained in:
Ryan Petrello 2017-02-16 08:44:06 -05:00 committed by GitHub
commit 424174154d

View File

@ -345,6 +345,9 @@ class Credential(PasswordFieldsModel, CommonModelNameNotUnique, ResourceMixin):
if self.has_encrypted_ssh_key_data and not self.ssh_key_unlock:
raise ValidationError(_('SSH key unlock must be set when SSH key '
'is encrypted.'))
if not self.has_encrypted_ssh_key_data and self.ssh_key_unlock:
raise ValidationError(_('SSH key unlock should not be set when '
'SSH key is not encrypted.'))
return self.ssh_key_unlock
def clean(self):