Class: Bolt::Config::Transport::SSH

Inherits:
Base
  • Object
show all
Defined in:
lib/bolt/config/transport/ssh.rb

Constant Summary collapse

OPTIONS =

Options available when using the net-ssh-based transport

%w[
  cleanup
  connect-timeout
  disconnect-timeout
  encryption-algorithms
  extensions
  host
  host-key-algorithms
  host-key-check
  interpreters
  kex-algorithms
  load-config
  login-shell
  mac-algorithms
  password
  port
  private-key
  proxyjump
  script-dir
  tmpdir
  tty
  user
].concat(RUN_AS_OPTIONS).sort.freeze
NATIVE_OPTIONS =

Options available when using the native ssh transport

%w[
  batch-mode
  cleanup
  copy-command
  host
  host-key-check
  interpreters
  native-ssh
  port
  private-key
  script-dir
  ssh-command
  tmpdir
  user
].concat(RUN_AS_OPTIONS).sort.freeze
DEFAULTS =
{
  "batch-mode"         => true,
  "cleanup"            => true,
  "connect-timeout"    => 10,
  "disconnect-timeout" => 5,
  "load-config"        => true,
  "login-shell"        => 'bash',
  "tty"                => false
}.freeze

Constants included from Options

Options::LOGIN_SHELLS, Options::RUN_AS_OPTIONS, Options::TRANSPORT_OPTIONS

Instance Attribute Summary

Attributes inherited from Base

#input

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#[], #dig, #fetch, #include?, #merge, #resolve, #resolved?, #to_h

Constructor Details

#initialize(data = {}, project = nil) ⇒ SSH

The set of options available for the ssh and native ssh transports overlap, so we need to check which transport is used before fully initializing, otherwise options may not be filtered correctly.



65
66
67
68
69
# File 'lib/bolt/config/transport/ssh.rb', line 65

def initialize(data = {}, project = nil)
  assert_hash_or_config(data)
  @native = true if data['native-ssh']
  super(data, project)
end

Class Method Details

.optionsObject

This method is used to filter CLI options in the Config class. This should include ‘ssh-command` so that we can later warn if the option is present without `native-ssh`



74
75
76
# File 'lib/bolt/config/transport/ssh.rb', line 74

def self.options
  %w[ssh-command native-ssh].concat(OPTIONS)
end

.schemaObject



78
79
80
81
82
83
84
# File 'lib/bolt/config/transport/ssh.rb', line 78

def self.schema
  {
    type:       Hash,
    properties: self::TRANSPORT_OPTIONS.slice(*(self::OPTIONS + self::NATIVE_OPTIONS)),
    _plugin:    true
  }
end