Class: Kontena::Cli::Apps::LogsCommand

Inherits:
Kontena::Command
  • Object
show all
Includes:
Common, Common, GridOptions, Helpers::LogHelper
Defined in:
lib/kontena/cli/apps/logs_command.rb

Instance Method Summary collapse

Methods included from Common

#abort_on_validation_errors, #app_json, #create_yml, #current_dir, #display_notifications, #generate_services, #hint_on_validation_notifications, #prefixed_name, #project_name_from_yaml, #read_yaml, #require_config_file, #service_exists?, #service_prefix, #services_from_yaml, #set_env_variables, #token, #valid_addons

Instance Method Details

#executeObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/kontena/cli/apps/logs_command.rb', line 16

def execute
  require_config_file(filename)

  services = services_from_yaml(filename, service_list, service_prefix, true)

  if services.empty? && !service_list.empty?
    signal_error "No such service: #{service_list.join(', ')}"
  elsif services.empty?
    signal_error "No services for application"
  end

  query_services = services.map{|service_name, opts| prefixed_name(service_name)}.join ','
  query_params = {
    services: query_services,
  }

  show_logs("grids/#{current_grid}/container_logs", query_params) do |log|
    show_log(log)
  end
end