Skip to content

Commit 8d21cfa

Browse files
committed
fix variable assignment order problem
1 parent 0637ef1 commit 8d21cfa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

microarmy/communications.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ def ssh_connect(host, port=22):
2525

2626
# if the password wasn't defined in settings, ask for it
2727
if not ec2_ssh_key_password:
28-
ec2_ssh_key_password = getpass.getpass(prompt='\nFound an encrypted private SSH key, please enter your decryption password: ')
28+
rsa_key_password = getpass.getpass(prompt='\nFound an encrypted private SSH key, please enter your decryption password: ')
29+
else:
30+
rsa_key_password = ec2_ssh_key_password
2931

3032
# setup the pkey object by reading the file from disk, with a decryption password
31-
rsa_key = paramiko.RSAKey.from_private_key_file(os.path.expanduser(ec2_ssh_key), password=ec2_ssh_key_password)
33+
rsa_key = paramiko.RSAKey.from_private_key_file(os.path.expanduser(ec2_ssh_key), password=rsa_key_password)
3234

3335
# pass pkey object to connection
3436
transport.connect(username=ec2_ssh_username, pkey=rsa_key)

0 commit comments

Comments
 (0)