Class: Exec::ServiceComponentDelete

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

Overview

Allows the user to delete 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
# File 'lib/exec/service_component_delete.rb', line 27

def exec
  # @todo traiter les exceptions
  Color::print_log("NONE", "deleting service component...", @stdout)
  cmd = Command::AmbariServiceComponentDelete.new(@values["cluster"], @values["component"], @values["host"])
  cmd.exec()
  Color::echo_ok(@stdout)
  @stdout.puts("Component #{@values["component"]} has been successfully removed from host #{@values["host"]} in cluster #{@values["cluster"]}.")
end

#set_optionsObject (private)

Parse and check the parameters of the function.



17
18
19
20
21
22
23
# File 'lib/exec/service_component_delete.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