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
-
#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.
25 26 27 28 29 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 25 def initialize(name, prompt: nil, password: nil) @name = name @prompt = prompt @password = password end |
Instance Attribute Details
#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
31 32 33 34 35 36 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 31 def ssh_command_prefix return [] unless @password prompt = ['-P', @prompt] if @prompt [{'SSHPASS' => SensitiveString.new(@password)}, 'sshpass', '-e', prompt].compact end |
#ssh_options ⇒ Object
38 39 40 41 |
# File 'lib/smart_proxy_remote_execution_ssh/multiplexed_ssh_connection.rb', line 38 def ["-o PreferredAuthentications=#{name}", "-o NumberOfPasswordPrompts=#{@password ? 1 : 0}"] end |