class Pocketknife::Error::NodeError::ExecutionError

ExecutionError

Exception raised when something goes wrong executing commands against remote host.

Attributes

cause[RW]

@return [Rye::Err] Cause of exception, a Rye:Err.

command[RW]

@return [String] Command that failed.

immediate[RW]

@return [Boolean] Was execution’s output shown immediately? If so, don’t include output in message.

Private Class Methods

new(node, command, cause, immediate) click to toggle source

Instantiates a new exception.

@param [String] node The name of the unknown node. @param [String] command The command that failed. @param [Rye::Err] cause The actual exception thrown. @param [Boolean] immediate Was execution’s output shown immediately? If so, don’t include output in message.

Calls superclass method Pocketknife::Error::NodeError::new
# File lib/pocketknife/errors.rb, line 83
        def initialize(node, command, cause, immediate)
          self.command = command
          self.cause = cause
          self.immediate = immediate

          message = <<-HERE.chomp
Failed while executing commands on node '#{node}'
- COMMAND: #{command}
- EXIT STATUS: #{cause.exit_status}
          HERE

          unless immediate
            message << <<-HERE.chomp

- STDOUT: #{cause.stdout.to_s.strip}
- STDERR: #{cause.stderr.to_s.strip}
            HERE
          end

          super(message, node)
        end

Private Instance Methods

exit_status() click to toggle source

Returns exit status.

@return [Integer] Exit status from execution.

# File lib/pocketknife/errors.rb, line 108
def exit_status
  return self.cause.exit_status
end