Class: Exec::ServiceComponentAdd

Inherits:
ExecutableCommand show all
Defined in:
lib/exec/service_component_add.rb

Overview

Allows the user to add a service component.

Instance Attribute Summary

Attributes inherited from ExecutableCommand

#argv, #command_name, #logger, #options, #stderr, #stdin, #stdout, #values

Instance Method Summary collapse

Methods inherited from ExecutableCommand

#check_parameters, #create_logger, #initialize, #run

Constructor Details

This class inherits a constructor from Exec::ExecutableCommand

Instance Method Details

#execObject (private)

Execution of the command



27
28
29
30
31
32
33
34
35
36
# File 'lib/exec/service_component_add.rb', line 27

def exec
  # @todo traiter les exceptions
  Color::print_log("NONE", "adding service on cluser...", @stdout)
  @values["host"].split(" ").each do |host|
    cmd = Command::AmbariServiceComponentAdd.new(@values["cluster"], @values["component"], host)
    cmd.exec()
    Color::echo_ok(@stdout)
    @stdout.puts("Component #{@values["component"]} has been successfully added on host #{@values["host"]} in cluster #{@values["cluster"]}.")
  end
end

#set_optionsObject (private)

Parse and check the parameters of the function.



17
18
19
20
21
22
23
# File 'lib/exec/service_component_add.rb', line 17

def set_options
  @logger.info("setting options")
  @options.add_option("C", "cluster", "The virtual cluster name.", true, true, method(:check_cluster_name))
  @options.add_option("H", "host", "Limit request to this host.", true, true, method(:check_ambari_host_name))
  @options.add_option("c", "component", "Limit request to this component type.", false, true, method(:check_hadoop_component_name))
  @options.add_option("f", "follow", "Follow completion of the request.", false)
end