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

Added Functionality to support Non-Standard SSH Port in the Adapters. #797

Merged
merged 6 commits into from
Feb 17, 2023

Conversation

gerald-byrket
Copy link
Contributor

@gerald-byrket gerald-byrket commented Feb 16, 2023

Added Functionality to support Non-Standard SSH Port in the Adapters.

The environment variable for ssh port is: ENV['OOD_SSH_PORT']

┆Issue is synchronized with this Asana task by Unito

@gerald-byrket gerald-byrket marked this pull request as ready for review February 16, 2023 20:08
@@ -26,7 +26,7 @@ def self.ssh_wrap(submit_host, cmd, cmd_args, strict_host_checking = true, env =
return cmd, cmd_args if submit_host.to_s.empty?

check_host = strict_host_checking ? "yes" : "no"
args = ['-o', 'BatchMode=yes', '-o', 'UserKnownHostsFile=/dev/null', '-o', "StrictHostKeyChecking=#{check_host}", "#{submit_host}"]
args = ['-p', ENV["OOD_SSH_PORT"].nil? ? "22" : "#{ENV['OOD_SSH_PORT']}", '-o', 'BatchMode=yes', '-o', 'UserKnownHostsFile=/dev/null', '-o', "StrictHostKeyChecking=#{check_host}", "#{submit_host}"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this logic in a helper function like this so other things can just refercen the fuction without the logic. (also be sure to cast to an integer)

def ssh_port
  ENV["OOD_SSH_PORT"].nil? ? "22" : ENV['OOD_SSH_PORT'].to_i.to_s
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put this logic in a helper function like this so other things can just refercen the fuction without the logic. (also be sure to cast to an integer)

def ssh_port
  ENV["OOD_SSH_PORT"].nil? ? "22" : ENV['OOD_SSH_PORT'].to_i.to_s
end

The Helper is a good idea. Thanks!

Copy link
Contributor

@johrstrom johrstrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gerald-byrket gerald-byrket merged commit ba7ba70 into master Feb 17, 2023
@gerald-byrket gerald-byrket deleted the ssh-nonstandard-port branch February 17, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for Non-Standard SSH Ports in Linux Host Adapter as well as entire OnDemand System
2 participants