Module: EY::Stonith::Commands

Defined in:
lib/ey_stonith/commands.rb,
lib/ey_stonith/commands/cron.rb,
lib/ey_stonith/commands/help.rb,
lib/ey_stonith/commands/info.rb,
lib/ey_stonith/commands/stop.rb,
lib/ey_stonith/commands/check.rb,
lib/ey_stonith/commands/claim.rb,
lib/ey_stonith/commands/reset.rb,
lib/ey_stonith/commands/notify.rb,
lib/ey_stonith/commands/resume.rb,
lib/ey_stonith/commands/status.rb,
lib/ey_stonith/commands/abstract.rb,
lib/ey_stonith/commands/commands.rb,
lib/ey_stonith/commands/takeover.rb,
lib/ey_stonith/commands/not_found.rb

Defined Under Namespace

Classes: Abstract, Check, Claim, Commands, Cron, Help, Info, NotFound, Notify, Reset, Resume, Status, Stop, Takeover

Constant Summary collapse

COMMANDS =
Hash.new(:NotFound).merge({
  'check'    => :Check,
  'claim'    => :Claim,
  'commands' => :Commands,
  'cron'     => :Cron,
  'help'     => :Help,
  'info'     => :Info,
  'notify'   => :Notify,
  'resume'   => :Resume,
  'reset'    => :Reset,
  'status'   => :Status,
  'stop'     => :Stop,
  'takeover' => :Takeover,
})

Class Method Summary collapse

Class Method Details

.formatted_command_listObject



36
37
38
39
40
41
# File 'lib/ey_stonith/commands.rb', line 36

def self.formatted_command_list
  COMMANDS.sort { |(a,_),(b,_)| a <=> b }.map { |cmd, klass_name|
    klass = const_get(klass_name)
    "    #{cmd.ljust(8)}   #{klass.banner}"
  }.join("\n")
end

.invoke(argv) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/ey_stonith/commands.rb', line 28

def self.invoke(argv)
  if COMMANDS.keys.include?(argv.first)
    exec "#{File.dirname($0)}/stonith-#{argv.join(' ')}"
  else
    NotFound.new(argv).call
  end
end