Class: Checkson::Check::Shell

Inherits:
Base
  • Object
show all
Defined in:
lib/checkson/checks/shell.rb,
lib/checkson/checks/packages.rb

Direct Known Subclasses

Process

Instance Attribute Summary

Attributes inherited from Base

#messages, #status

Instance Method Summary collapse

Methods inherited from Base

#failed?, #ok?

Constructor Details

#initialize(opts = {}) ⇒ Shell

Returns a new instance of Shell.



6
7
8
9
# File 'lib/checkson/checks/shell.rb', line 6

def initialize(opts = {})
  @opts = (@opts || {}).merge(opts)
  super()
end

Instance Method Details

#checkObject

Raises:

  • (ArgumentError)


11
12
13
14
15
16
# File 'lib/checkson/checks/shell.rb', line 11

def check
  raise ArgumentError, 'No code given' unless @opts[:code]

  execute(@opts[:code])
  failed! unless $?.exitstatus.zero?
end