class Kafkat::ClusterRestart::Subcommands::Good
Attributes
session[R]
Public Instance Methods
restart(broker_id)
click to toggle source
# File lib/kafkat/command/cluster_restart.rb, line 162 def restart(broker_id) @session = Session.load! begin if session.pending?(broker_id) session.update_states!(Session::STATE_RESTARTED, [broker_id]) session.save! else puts "ERROR Broker state is #{session.state(broker_id)}" exit 1 end rescue UnknownBrokerError => e puts "ERROR #{e.to_s}" exit 1 end end
run()
click to toggle source
# File lib/kafkat/command/cluster_restart.rb, line 145 def run unless Session.exists? puts "ERROR: no session in progress" puts "\n[Action] Please run 'start' command" exit 1 end broker_id = ARGV[0] if broker_id.nil? puts "ERROR You must specify a broker id" exit 1 end restart(broker_id) puts "Broker #{broker_id} has been marked as restarted" puts "\n[Action] Please run 'next' to select the broker with lowest restarting cost" end