Module: Dopi::Connector::Ssh

Instance Method Summary collapse

Methods included from Dopi::CommandParser::Credentials

#credentials, #validate_credentials

Methods included from Local

#local_command

Instance Method Details

#base64Object



42
43
44
# File 'lib/dopi/connector/ssh.rb', line 42

def base64
  @base64 || base64_valid? ? hash[:base64] : true
end

#check_host_keyObject



38
39
40
# File 'lib/dopi/connector/ssh.rb', line 38

def check_host_key
  @check_host_key || check_host_key_valid? ? hash[:check_host_key] : false
end

#portObject



30
31
32
# File 'lib/dopi/connector/ssh.rb', line 30

def port
  @port ||= port_valid? ? hash[:port].to_s : '22'
end

#quietObject



34
35
36
# File 'lib/dopi/connector/ssh.rb', line 34

def quiet
  @quiet || quiet_valid? ? hash[:quiet] : true
end

#ssh_command(env, command_string) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/dopi/connector/ssh.rb', line 22

def ssh_command(env, command_string)
  credential = working_ssh_credential
  ssh_command_string = create_ssh_command_string(credential, env, command_string)
  local_env = create_local_env(credential)
  local_env.merge!(env) unless base64 # keep old behaviour for escaping
  local_command(local_env, ssh_command_string)
end

#ssh_optionsObject



46
47
48
49
# File 'lib/dopi/connector/ssh.rb', line 46

def ssh_options
  #TBD
  []
end

#supported_credential_typesObject



51
52
53
# File 'lib/dopi/connector/ssh.rb', line 51

def supported_credential_types
  [:username_password, :ssh_key]
end

#validate_sshObject



13
14
15
16
17
18
19
20
# File 'lib/dopi/connector/ssh.rb', line 13

def validate_ssh
  log_validation_method(:port_valid?, CommandParsingError)
  log_validation_method(:quiet_valid?, CommandParsingError)
  log_validation_method(:check_host_key_valid?, CommandParsingError)
  log_validation_method(:base64_valid?, CommandParsingError)
  log_validation_method(:ssh_options_valid?, CommandParsingError)
  validate_credentials
end