Skip to content
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

Fix for issue #144 #473

Merged
merged 7 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ebcli/operations/sshops.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def ssh_into_instance(instance_id, keep_open=False, force_open=False, custom_ssh
custom_ssh = custom_ssh.split()
else:
ident_file = _get_ssh_file(keypair_name)
custom_ssh = ['ssh', '-i', ident_file]
custom_ssh = ['ssh', '-i', ident_file, '-o', 'IdentitiesOnly yes']

custom_ssh.extend([user + '@' + ip])

Expand Down
8 changes: 4 additions & 4 deletions tests/unit/operations/test_sshops.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def test_generate_and_upload_keypair__exit_code_0(
'-f',
os.path.expanduser('~') + '{0}.ssh{0}aws-eb-us-west-2'.format(os.path.sep),
'-C',
'aws-eb-us-west-2'
'aws-eb-us-west-2'
]
)

Expand Down Expand Up @@ -320,7 +320,7 @@ def test_ssh_into_instance__uses_private_address(
call_mock.return_value = 0

sshops.ssh_into_instance('instance-id')
call_mock.assert_called_once_with(['ssh', '-i', 'aws-eb-us-west-2', 'ec2-user@172.31.35.210'])
call_mock.assert_called_once_with(['ssh', '-i', 'aws-eb-us-west-2', '-o', 'IdentitiesOnly yes', 'ec2-user@172.31.35.210'])

@mock.patch('ebcli.operations.sshops.ec2.describe_instance')
@mock.patch('ebcli.operations.sshops.ec2.describe_security_group')
Expand All @@ -346,7 +346,7 @@ def test_ssh_into_instance__ssh_rule_exists(
sshops.ssh_into_instance('instance-id')
authorize_ssh_mock.assert_not_called()
revoke_ssh_mock.assert_not_called()
call_mock.assert_called_once_with(['ssh', '-i', 'aws-eb-us-west-2', 'ec2-user@54.218.96.238'])
call_mock.assert_called_once_with(['ssh', '-i', 'aws-eb-us-west-2', '-o', 'IdentitiesOnly yes', 'ec2-user@54.218.96.238'])

@mock.patch('ebcli.operations.sshops.ec2.describe_instance')
@mock.patch('ebcli.operations.sshops.ec2.describe_security_group')
Expand All @@ -372,7 +372,7 @@ def test_ssh_into_instance__no_ssh_rule_exists(
sshops.ssh_into_instance('instance-id')
authorize_ssh_mock.assert_called_once_with('sg-12312313')
revoke_ssh_mock.assert_called_once_with('sg-12312313')
call_mock.assert_called_once_with(['ssh', '-i', 'aws-eb-us-west-2', 'ec2-user@54.218.96.238'])
call_mock.assert_called_once_with(['ssh', '-i', 'aws-eb-us-west-2', '-o', 'IdentitiesOnly yes', 'ec2-user@54.218.96.238'])

@mock.patch('ebcli.operations.sshops.prompt_for_ec2_keyname')
@mock.patch('ebcli.operations.sshops.commonops.update_environment')
Expand Down
Loading