Class: Kafkat::ClusterRestart::Subcommands::Start

Inherits:
Kafkat::Command::Base show all
Defined in:
lib/kafkat/command/cluster_restart.rb

Instance Attribute Summary collapse

Attributes inherited from Kafkat::Command::Base

#config

Instance Method Summary collapse

Methods inherited from Kafkat::Command::Base

#admin, #initialize, #kafka_logs, register_as, usage, usages, #zookeeper

Methods included from Logging

#print_err

Methods included from Kafkat::CommandIO

#prompt_and_execute_assignments

Methods included from Formatting

#justify, #print_assignment, #print_assignment_header, #print_broker, #print_broker_header, #print_partition, #print_partition_header, #print_topic, #print_topic_header, #print_topic_name

Constructor Details

This class inherits a constructor from Kafkat::Command::Base

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



42
43
44
# File 'lib/kafkat/command/cluster_restart.rb', line 42

def session
  @session
end

Instance Method Details

#runObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/kafkat/command/cluster_restart.rb', line 44

def run
  if Session.exists?
    puts "ERROR: A session is already started"
    puts "\n[Action] Please run 'next' or 'reset' commands"
    exit 1
  end

  print "Starting a new Cluster-Restart session.\n"

  @session = Session.from_zookeepers(zookeeper)
  @session.save!

  puts "\n[Action] Please run 'next' to select the broker with lowest restarting cost"
end