module Patriot::Tool::PatriotCommands::WorkerAdmin

remote worker administration tool

Public Instance Methods

print_status(result, opts) click to toggle source
worker_admin(sub_cmd) click to toggle source
# File lib/patriot/tool/patriot_commands/worker_admin.rb, line 19
def worker_admin(sub_cmd)
  sub_cmd = "#{sub_cmd}_worker" unless sub_cmd == "status"
  begin
    opts = symbolize_options(options)
    conf        = {:type => 'worker_admin'}
    conf[:path] = opts[:config] if opts.has_key?(:config)
    config      = load_config(conf)
    controller  = Patriot::Controller::WorkerAdminController.new(config)
    result = controller.send(sub_cmd.to_sym, opts)
    print_mtd ="print_#{sub_cmd}".to_sym
    self.send(print_mtd, result, opts) if self.respond_to?(print_mtd)
  rescue => e
    puts e
    raise e
  end
end