-
-
Notifications
You must be signed in to change notification settings - Fork 745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear error message when passphrase not supplied with encrypted private key #2755
Clear error message when passphrase not supplied with encrypted private key #2755
Conversation
except paramiko.ssh_exception.PasswordRequiredException: | ||
msg = ('Private key file %s is passphrase protected. Supply a passphrase!' % | ||
self.key_files) | ||
raise Exception(msg) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default message in that exception sends out a cryptic message that's not obvious to user. Hence I send out a generic exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please log the original exception.
👍 |
Good catch - thanks! Let's please also add a test case for it. |
Added unit test: 1bf5009#diff-4e2bf97e5b553c71e4a57637fb0d1253R148 |
…ase_protected_keys * master: update changelog Test for show_secrets param cli support for unmasking secrets if user is an admin Fix imports change base class add missing import Use _get_mask_secrets in actionexecutions Ability to show_secrets for admin as applied to apikeys Use the right mask_secrets property Conflicts: CHANGELOG.rst
@@ -49,6 +51,8 @@ def test_connect_with_password(self): | |||
client._hosts_client[host].client.connect.assert_called_once_with(**expected_conn) | |||
|
|||
@patch('paramiko.SSHClient', Mock) | |||
@patch.object(ParamikoSSHClient, '_is_key_file_needs_passphrase', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needing to patch this "implementation detail" everywhere is kinda nasty and hard to maintain - is there no other way to achieve that?
Anyways, thanks for adding the test 👍
Before
After