Class: ScriptExecutionProvider

Inherits:
RemoteExecutionProvider show all
Defined in:
app/models/script_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, remote_working_dir, required_proxy_selector_for, time_to_pickup

Class Method Details

.cockpit_url_for_host(host) ⇒ Object



55
56
57
# File 'app/models/script_execution_provider.rb', line 55

def cockpit_url_for_host(host)
  format(Setting[:remote_execution_cockpit_url], host: host) if Setting[:remote_execution_cockpit_url].present?
end

.humanized_nameObject



14
15
16
# File 'app/models/script_execution_provider.rb', line 14

def humanized_name
  _('Script')
end

.proxy_command_options(template_invocation, host) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'app/models/script_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),
    remote_working_dir: remote_working_dir(host),
    ssh_port: ssh_port(host)
  )
end

.proxy_featureObject



59
60
61
# File 'app/models/script_execution_provider.rb', line 59

def proxy_feature
  %w(SSH Script)
end

.proxy_operation_nameObject



30
31
32
# File 'app/models/script_execution_provider.rb', line 30

def proxy_operation_name
  'ssh'
end

.secrets(host) ⇒ Object



34
35
36
37
38
39
40
# File 'app/models/script_execution_provider.rb', line 34

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



26
27
28
# File 'app/models/script_execution_provider.rb', line 26

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

.ssh_params(host) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/models/script_execution_provider.rb', line 42

def ssh_params(host)
  proxy = proxy_for_cockpit(host)
  {
    :hostname => find_ip_or_hostname(host),
    :proxy => proxy.instance_of?(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



22
23
24
# File 'app/models/script_execution_provider.rb', line 22

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

.supports_effective_user?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'app/models/script_execution_provider.rb', line 18

def supports_effective_user?
  true
end