Class: ScriptExecutionProvider

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

alternative_names, cleanup_working_dirs?, effective_interfaces, effective_user, effective_user_method, effective_user_password, find_fqdn, find_ip, find_ip_or_hostname, host_setting, provider_for, provider_input_namespace, provider_inputs, provider_inputs_doc, provider_names, provider_proxy_features, providers, proxy_action_class, proxy_batch_size, proxy_command_provider_inputs, register, registered_name, required_proxy_selector_for, time_to_pickup

Class Method Details

.cockpit_url_for_host(host) ⇒ Object



52
53
54
# File 'app/models/ssh_execution_provider.rb', line 52

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

.humanized_nameObject



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

def humanized_name
  _('Script')
end

.proxy_command_options(template_invocation, host) ⇒ Object



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

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

.proxy_featureObject



56
57
58
# File 'app/models/ssh_execution_provider.rb', line 56

def proxy_feature
  %w(SSH Script)
end

.proxy_operation_nameObject



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

def proxy_operation_name
  'ssh'
end

.secrets(host) ⇒ Object



31
32
33
34
35
36
37
# File 'app/models/ssh_execution_provider.rb', line 31

def secrets(host)
  {
    :ssh_password => ssh_password(host),
    :key_passphrase => ssh_key_passphrase(host),
    :effective_user_password => effective_user_password(host),
  }
end

.ssh_key_passphrase(host) ⇒ Object



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

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

.ssh_params(host) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/models/ssh_execution_provider.rb', line 39

def ssh_params(host)
  proxy = proxy_for_cockpit(host)
  {
    :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),
    :effective_user_password => effective_user_password(host),
  }
end

.ssh_password(host) ⇒ Object



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

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

.supports_effective_user?Boolean

Returns:

  • (Boolean)


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

def supports_effective_user?
  true
end