Exception: Tomo::SSH::ScriptError

Inherits:
Error
  • Object
show all
Defined in:
lib/tomo/ssh/script_error.rb

Instance Attribute Summary collapse

Attributes inherited from Error

#host

Instance Method Summary collapse

Methods inherited from Error

raise_with

Methods included from Colors

enabled?

Instance Attribute Details

#resultObject

Returns the value of attribute result.



8
9
10
# File 'lib/tomo/ssh/script_error.rb', line 8

def result
  @result
end

#scriptObject

Returns the value of attribute script.



8
9
10
# File 'lib/tomo/ssh/script_error.rb', line 8

def script
  @script
end

#ssh_argsObject

Returns the value of attribute ssh_args.



8
9
10
# File 'lib/tomo/ssh/script_error.rb', line 8

def ssh_args
  @ssh_args
end

Instance Method Details

#to_consoleObject



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/tomo/ssh/script_error.rb', line 10

def to_console
  msg = <<~ERROR
    The following script failed on #{yellow(host)} (exit status #{red(result.exit_status)}).

      #{yellow(script)}

    You can manually re-execute the script via SSH as follows:

      #{gray(ssh_args.map(&:shellescape).join(' '))}
  ERROR

  [msg, super].join("\n")
end