class Kafkat::Command::CleanIndexes

Public Instance Methods

run() click to toggle source
# File lib/kafkat/command/clean-indexes.rb, line 9
def run
  print "This operation will remove any untruncated index files.\n"
  return unless ask("Proceed (y/n)?")

  begin
    print "\nStarted.\n"
    count = kafka_logs.clean_indexes!
    print "\nDone (#{count} index file(s) removed).\n"
  rescue Interface::KafkaLogs::NoLogsError => e
    print "ERROR: Kakfa log directory doesn't exist.\n"
    exit 1
  rescue Interface::KafkaLogs::KafkaRunningError => e
    print "ERROR: Kafka is still running.\n"
    exit 1
  rescue => e
    print "ERROR: #{e}\n"
    exit 1
  end
end