Class: SSHExecutionProvider

Inherits:
RemoteExecutionProvider show all
Defined in:
app/models/ssh_execution_provider.rb

Constant Summary

Constants inherited from RemoteExecutionProvider

RemoteExecutionProvider::EFFECTIVE_USER_METHODS

Class Method Summary collapse

Methods inherited from RemoteExecutionProvider

cleanup_working_dirs?, effective_interfaces, effective_user, effective_user_method, find_fqdn, find_ip, find_ip_or_hostname, host_setting, provider_for, provider_names, providers, register, sudo_password

Class Method Details

.cockpit_url_for_host(host) ⇒ Object



45
46
47
# File 'app/models/ssh_execution_provider.rb', line 45

def cockpit_url_for_host(host)
  Setting[:remote_execution_cockpit_url] % { :host => host } if Setting[:remote_execution_cockpit_url].present?
end

.humanized_nameObject



12
13
14
# File 'app/models/ssh_execution_provider.rb', line 12

def humanized_name
  _('SSH')
end

.proxy_command_options(template_invocation, host) ⇒ Object



3
4
5
6
7
8
9
10
# File 'app/models/ssh_execution_provider.rb', line 3

def proxy_command_options(template_invocation, host)
  super.merge(:ssh_user => ssh_user(host),
              :effective_user => effective_user(template_invocation),
              :effective_user_method => effective_user_method(host),
              :cleanup_working_dirs => cleanup_working_dirs?(host),
              :sudo_password => sudo_password(host),
              :ssh_port => ssh_port(host))
end

.proxy_operation_nameObject



28
29
30
# File 'app/models/ssh_execution_provider.rb', line 28

def proxy_operation_name
  'ssh'
end

.ssh_key_passphrase(host) ⇒ Object



24
25
26
# File 'app/models/ssh_execution_provider.rb', line 24

def ssh_key_passphrase(host)
  host_setting(host, :remote_execution_ssh_key_passphrase)
end

.ssh_params(host) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/models/ssh_execution_provider.rb', line 32

def ssh_params(host)
  proxy_selector = ::RemoteExecutionProxySelector.new
  proxy = proxy_selector.determine_proxy(host, 'SSH')
  {
    :hostname => find_ip_or_hostname(host),
    :proxy => proxy.class == Symbol ? proxy : proxy.url,
    :ssh_user => ssh_user(host),
    :ssh_port => ssh_port(host),
    :ssh_password => ssh_password(host),
    :ssh_key_passphrase => ssh_key_passphrase(host)
  }
end

.ssh_password(host) ⇒ Object



20
21
22
# File 'app/models/ssh_execution_provider.rb', line 20

def ssh_password(host)
  host_setting(host, :remote_execution_ssh_password)
end

.supports_effective_user?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'app/models/ssh_execution_provider.rb', line 16

def supports_effective_user?
  true
end