class Kafkat::Command::Resign

Public Instance Methods

run() click to toggle source
# File lib/kafkat/command/shutdown.rb, line 9
def run
  broker_id = ARGV[0] && ARGV.shift.to_i
  if broker_id.nil?
    puts "You must specify a broker ID."
    exit 1
  end

  print "This operation gracefully removes leaderships from broker '#{broker_id}'.\n"
  return unless agree("Proceed (y/n)?")

  result = nil
  begin
    print "\nBeginning shutdown.\n"
    result = admin.shutdown!(broker_id)
    print "Started.\n"
  rescue Interface::Admin::ExecutionFailedError
    print result
  end
end