Class: OodCore::Job::Adapters::Helper Private
- Inherits:
-
Object
- Object
- OodCore::Job::Adapters::Helper
- Defined in:
- lib/ood_core/job/adapters/helper.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
-
.bin_path(cmd, bin_default, bin_overrides) ⇒ String
private
Get the configured path to a command allowing overrides from bin_overrides.
-
.ssh_port ⇒ Object
private
Allows for Non-Standard Port usage in ssh commands To set ENV, add assignment in /etc/ood/config/nginx_stage.yml.
-
.ssh_wrap(submit_host, cmd, cmd_args, strict_host_checking = true, env = {}) ⇒ Object
private
Gets a command that submits command on another host via ssh.
Class Method Details
.bin_path(cmd, bin_default, bin_overrides) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get the configured path to a command allowing overrides from bin_overrides
14 15 16 |
# File 'lib/ood_core/job/adapters/helper.rb', line 14 def self.bin_path(cmd, bin_default, bin_overrides) bin_overrides.fetch(cmd.to_s) { Pathname.new(bin_default.to_s).join(cmd.to_s).to_s } end |
.ssh_port ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Allows for Non-Standard Port usage in ssh commands To set ENV, add assignment in /etc/ood/config/nginx_stage.yml
43 44 45 |
# File 'lib/ood_core/job/adapters/helper.rb', line 43 def self.ssh_port return ENV["OOD_SSH_PORT"].nil? ? "22" : "#{ENV['OOD_SSH_PORT'].to_i.to_s}" end |
.ssh_wrap(submit_host, cmd, cmd_args, strict_host_checking = true, env = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Gets a command that submits command on another host via ssh
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/ood_core/job/adapters/helper.rb', line 27 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" # Have to OodCore::Job::Adapters::Helper.ssh_port instead of self.ssh_port due to test failure args = ['-p', OodCore::Job::Adapters::Helper.ssh_port, '-o', 'BatchMode=yes', '-o', 'UserKnownHostsFile=/dev/null', '-o', "StrictHostKeyChecking=#{check_host}", "#{submit_host}"] env.each { |key, value| args.push("export #{key}=#{Shellwords.escape(value.to_s)};") } return 'ssh', args + [cmd] + cmd_args.map { |arg| Shellwords.escape(arg.to_s) } end |