Class: Exec::ServiceConfApply

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

Overview

Allows the user to apply a configuration on a cluster.

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

#apply_configuration(cluster_name = @values["cluster"], type_conf = @values["type"], tag_conf = @values["tag"]) ⇒ Object (private)

Applies a service configuration.



49
50
51
52
53
54
# File 'lib/exec/service_conf_apply.rb', line 49

def apply_configuration(cluster_name = @values["cluster"], type_conf = @values["type"], tag_conf = @values["tag"])
  @logger.begin_main_step("applyConfigurations")
  command = Command::AmbariServiceConfApply.new(cluster_name, type_conf, tag_conf)
  command.exec()
  @logger.end_main_step("applyConfigurations")
end

#execObject

The execution of the command.



32
33
34
35
36
37
38
39
40
41
# File 'lib/exec/service_conf_apply.rb', line 32

def exec
  Color::print_log("NONE", "Applying configuration to the cluster '#{@values["cluster"]}'", @stdout)

  if !@values["cluster"].nil? && !@values["type"].nil? && !@values["tag"].nil?
    apply_configuration(@values["cluster"], @values["type"], @values["tag"])
    Color::echo_ok(@stdout)
  else
    raise ArgumentError.new("Arguments can't be nil!")
  end
end

#set_optionsObject (private)

Parse and check the parameters of the function.



22
23
24
25
26
27
# File 'lib/exec/service_conf_apply.rb', line 22

def set_options
  @logger.info("setting options")
  @options.add_option("C", "cluster", "The cluster name.", true, true, method(:check_cluster_name))
  @options.add_option("T", "type", "The type of the configuration.", true, true)
  @options.add_option("t", "tag", "The tag of the configuration.", true, true)
end