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

salt/utils/cloud: Allow to customize ssh gateway command/options #48062

Merged

Conversation

Projects
None yet
5 participants
@icy
Copy link
Contributor

commented Jun 12, 2018

What does this PR do?

By default, nc command (nc -q0 %h %p) is used to create gateway. This is not
always possible in some restricted environments. An alternative is to use
native support from ssh: -W %h:%p.

This commit allows user to provide a customize option for gateway. Please note
the (wait_for_port) process may need another patch.

What issues does this PR fix or reference?

Previous Behavior

Users are forced to use nc -q0 %h %p command to create ssh proxy for salt-cloud

New Behavior

Users can use a customized command to create ssh proxy for salt-cloud

Tests written?

NO

Commits signed with GPG?

Yes

salt/utils/cloud: Allow to customize ssh gateway command/options
By default, nc command (nc -q0 %h %p) is used to create gateway. This is not
always possible in some restricted environments. An alternative is to use
native support from ssh: -W %h:%p.

This commit allows user to provide a customize option for gateway. Please note
the (wait_for_port) process may need another patch.

@salt-jenkins salt-jenkins requested a review from saltstack/team-cloud Jun 12, 2018

icy added some commits Jun 12, 2018

@gtmanfred
Copy link
Contributor

left a comment

This should be documented in salt/cloud/clouds/ec2.py, as well as adding the gateway stuff to ./doc/topics/cloud/misc.rst

# Default to nc -q0 %h %p
# Optional
ssh_gateway_command: "-W %h:%p"

This comment has been minimized.

Copy link
@gtmanfred

gtmanfred Jun 12, 2018

Contributor

Can you remove this change, we compile these every time we build, so this will not remain.

This comment has been minimized.

Copy link
@icy

icy Jun 12, 2018

Author Contributor

thanks a lot. I will update ec2.py and misc.rst instead :)

icy added some commits Jun 13, 2018

Mike Place
@icy

This comment has been minimized.

Copy link
Contributor Author

commented Jun 13, 2018

Thanks @gtmanfred and @cachedout for your reviews and approvals.

@rallytime

This comment has been minimized.

Copy link
Contributor

commented Jun 15, 2018

Thanks @icy and congrats on your first salt PR. :)

@rallytime rallytime merged commit bf1b2e7 into saltstack:develop Jun 15, 2018

6 of 10 checks passed

jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #10669 — ABORTED
Details
default Build finished.
Details
jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #5698 — FAILURE
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #19752 — FAILURE
Details
WIP ready for review
Details
codeclimate 3 fixed issues
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #25897 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #17959 — SUCCESS
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #23628 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #22590 — SUCCESS
Details

rallytime added a commit that referenced this pull request Jun 19, 2018

Merge pull request #48199 from icyfork/pr-48062-fixes
Minor improvements and fixes for related PR: #48062
@rklaren

This comment has been minimized.

Copy link
Contributor

commented on salt/utils/cloud.py in 10c61be Aug 5, 2018

@icy shouldn't this log.info line be inside the if? It crashes if no gateway is defined....

This comment has been minimized.

Copy link
Contributor Author

replied Aug 6, 2018

Yes I agree :) All my manual tests were done with gateway settings. I will fix that. Thanks a lot for the catch.

This comment has been minimized.

Copy link
Contributor

replied Aug 6, 2018

You're welcome :) Good addition to make the gateway command configurable!

@icy

This comment has been minimized.

Copy link
Contributor Author

commented Aug 6, 2018

Hi @rallytime and @gtmanfred,

Is there any good start to write and improve unit tests (e.g., in my PRs)?

At my laptop, the tests are passed as seen here https://gist.github.com/icy/a59f975ba54224b7d941b2e38ccc74a1 , I don't think these tests are working fine. I did some smoke tests actually and it's not a recommended way (expensive?)

icy added a commit to icyfork/salt that referenced this pull request Aug 6, 2018

salt/utils/cloud: fix crash issue. Thanks @rklaren
Some variables are not in their right scope and makes salt crashed
when user settings do not include some gateway settings.

Cf: saltstack#48062

icy added a commit to icyfork/salt that referenced this pull request Aug 6, 2018

salt/utils/cloud: fix crash issue. Thanks @rklaren
Some variables are not in their right scope; that makes salt crashed
when user settings do not include some gateway settings.

Cf: saltstack#48062

rallytime added a commit to rallytime/salt that referenced this pull request Aug 23, 2018

salt/utils/cloud: fix crash issue. Thanks @rklaren
Some variables are not in their right scope; that makes salt crashed
when user settings do not include some gateway settings.

Cf: saltstack#48062
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.