class SSHake::ExecutionOptions
Attributes
A file that you wish to stream to the remote channel with the current commend
@return [File]
Should errors be raised?
@return [Boolean]
A proc to call whenever data is received on stderr
@return [Proc]
The data to pass to stdin when executing this command
@return [String]
A proc to call whenever data is received on stdout
@return [Proc]
The password to be provided to the interactive sudo prompt
@return [String]
The user to execute sudo commands as. If nil, commands will not be executed with sudo.
@return [String]
Public Class Methods
Return the default timeout
@return [Integer]
# File lib/sshake/execution_options.rb, line 65 def default_timeout @default_timeout || 60 end
Create a new set of options from a block
@return [SSHake::ExecutionOptions]
# File lib/sshake/execution_options.rb, line 99 def from_block options = new dsl = ExecutionOptionsDSL.new(options) yield dsl options end
Create a new set of options from a given hash
@param [Hash] hash @return [SSHake::ExecutionOptions]
# File lib/sshake/execution_options.rb, line 74 def from_hash(hash) options = new options.timeout = hash[:timeout] case hash[:sudo] when String options.sudo_user = hash[:sudo] when Hash options.sudo_user = hash[:sudo][:user] || 'root' options.sudo_password = hash[:sudo][:password] when true options.sudo_user = 'root' end # rubocop:disable Style/DoubleNegation options.raise_on_error = !!hash[:raise_on_error] # rubocop:enable Style/DoubleNegation options.stdin = hash[:stdin] options.stdout = hash[:stdout] options.stderr = hash[:stderr] options.file_to_stream = hash[:file_to_stream] options end
Public Instance Methods
Should errors be raised
@return [Boolean]
# File lib/sshake/execution_options.rb, line 56 def raise_on_error? !!@raise_on_error end
The timeout
@return [Integer]
# File lib/sshake/execution_options.rb, line 11 def timeout @timeout || self.class.default_timeout end