Class: Proxy::RemoteExecution::Ssh::Runners::AuthenticationMethod
- Inherits:
-
Object
- Object
- Proxy::RemoteExecution::Ssh::Runners::AuthenticationMethod
- Defined in:
- lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, prompt: nil, password: nil) ⇒ AuthenticationMethod
constructor
A new instance of AuthenticationMethod.
- #ssh_command_prefix ⇒ Object
- #ssh_options ⇒ Object
Constructor Details
#initialize(name, prompt: nil, password: nil) ⇒ AuthenticationMethod
Returns a new instance of AuthenticationMethod.
26 27 28 29 30 31 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 26 def initialize(name, prompt: nil, password: nil) @name = name @prompt = prompt @password = password @errors = nil end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
25 26 27 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 25 def errors @errors end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 24 def name @name end |
Instance Method Details
#ssh_command_prefix ⇒ Object
33 34 35 36 37 38 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 33 def ssh_command_prefix return [] unless @password prompt = ['-P', @prompt] if @prompt [{'SSHPASS' => SensitiveString.new(@password)}, 'sshpass', '-e', prompt].compact end |
#ssh_options ⇒ Object
40 41 42 43 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 40 def ["-o PreferredAuthentications=#{name}", "-o NumberOfPasswordPrompts=#{@password ? 1 : 0}"] end |