Sha256: e79c009235b1e3d84e50904ca93eb9126b0937e87c1920575881ebdd8ef29a4b

Contents?: true

Size: 1.74 KB

Versions: 21

Compression:

Stored size: 1.74 KB

Contents

class SSHExecutionProvider < RemoteExecutionProvider
  class << self
    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),
        :ssh_port => ssh_port(host))
    end

    def humanized_name
      _('SSH')
    end

    def supports_effective_user?
      true
    end

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

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

    def proxy_operation_name
      'ssh'
    end

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

    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

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

    private

    def ssh_user(host)
      host.host_param('remote_execution_ssh_user')
    end

    def ssh_port(host)
      Integer(host_setting(host, :remote_execution_ssh_port))
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
foreman_remote_execution-5.0.8 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.7 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.6 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.5 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.4 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.3 app/models/ssh_execution_provider.rb
foreman_remote_execution-6.0.0 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.2 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.1.0 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.1 app/models/ssh_execution_provider.rb
foreman_remote_execution-5.0.0 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.8.0 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.5.6 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.5.5 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.5.4 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.7.0 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.5.3 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.5.2 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.5.1 app/models/ssh_execution_provider.rb
foreman_remote_execution-4.6.0 app/models/ssh_execution_provider.rb