Class: Gizzard::AddHostCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/gizzard/commands.rb

Instance Attribute Summary

Attributes inherited from Command

#argv, #buffer, #command_options, #global_options, #job_injector, #manager

Instance Method Summary collapse

Methods inherited from Command

classify, #confirm!, #get_base_name, #help!, #initialize, make_job_injector, make_manager, #output, #require_tables, #require_template_options, run

Constructor Details

This class inherits a constructor from Gizzard::Command

Instance Method Details

#runObject



752
753
754
755
756
757
758
759
760
761
# File 'lib/gizzard/commands.rb', line 752

def run
  hosts = @argv.map do |arg|
    cluster, hostname, port = *arg.split(":")
    help!("malformed host argument") unless [cluster, hostname, port].compact.length == 3

    Host.new(hostname, port.to_i, cluster, HostStatus::Normal)
  end

  hosts.each {|h| manager.add_remote_host(h) }
end