Method: Exec::ServiceInfo#info_service

Defined in:
lib/exec/service_info.rb

#info_service(cluster_name = , service_name = , host_name = , component_name = , prefix = " ", prefix_char = " ") ⇒ Object (private)

Shows the information for specific services.

Parameters:

  • cluster_name (defaults to: )

    The name of the cluster.

  • service_name (defaults to: )

    The name of the service.

  • host_name (defaults to: )

    The name of the host.

  • component_name (defaults to: )

    The name of the component.

  • prefix (defaults to: " ")

    The prefix to show before the services.

  • prefix_char (defaults to: " ")

    The prefix character to show before the services.

Returns:

  • The information to print.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/exec/service_info.rb', line 99

def info_service(cluster_name = @values["cluster"], service_name = @values["service"], host_name = @values["host"], component_name = @values["component"], prefix = "  ", prefix_char = "  ")
  @logger.begin_execution("infoService")
  begin
    output = color_white("Service #{service_name} on cluster #{cluster_name}", 1) + " :\n"
    output += "Display only host '#{host_name}'\n" if !host_name.nil?
    output += "Display only component '#{component_name}'\n" if !component_name.nil?

    data = Command::AmbariServiceInfo.new(cluster_name, service_name).exec()

    data["components"] = data["components"].sort { |x, y| x["href"] <=> y["href"] }
    @logger.debug(data)
    output += format_info_service(data, host_name, component_name, prefix + prefix_char, prefix_char)
  rescue => e
    raise e
  end

  @logger.info("output info service: #{output}")
  @logger.end_execution()
  return output
end