Class: Proctor::Command::StartCmd

Inherits:
Object
  • Object
show all
Includes:
Helpers::Command, Resource::Erb, Resource::Lookup
Defined in:
lib/proctor/command/start_cmd.rb

Instance Method Summary collapse

Methods included from Resource::Lookup

#lookup_valid_group_template, #lookup_valid_manager, #lookup_valid_node, #lookup_valid_service, #lookup_valid_service_template, #lookup_valid_services, #lookup_valid_services_hash

Methods included from Resource::Erb

#erb_ify, #erb_ify_hash, #erb_ify_services, #generate_group_erb, #generate_group_header, #generate_service_erb, #generate_service_header, #render_group_template, #render_service_template

Methods included from Helpers::Command

#check_number_of_args, #options_msg

Constructor Details

#initialize(global, options, args) ⇒ StartCmd

Returns a new instance of StartCmd.



13
14
15
16
17
18
19
# File 'lib/proctor/command/start_cmd.rb', line 13

def initialize(global, options, args)
  @env       = options['env']
  @manager   = args[0]
  @node      = args[1]
  opts = {'MANAGERS' => @env.managers.names, 'NODES' => @env.nodes.names}
  check_number_of_args(args, 2, 'start MANAGER NODE', opts)
end

Instance Method Details

#startObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/proctor/command/start_cmd.rb', line 21

def start
  env = @env
  _manager = lookup_valid_manager(@manager, @env)
  #update_manager_with_cl_options(manager)
  manager = erb_ify(_manager, {}, env)
  node = lookup_valid_node(@node, @env)
  if manager.data["group_data"]
    start_group(manager)
  end
  if manager.data["service_data"]
    node.services.each do |service_name|
      service = lookup_valid_service(service_name, @env)
      start_service(manager, service, @env)
    end
  end
end