Class: MiscController

Inherits:
ApplicationController show all
Defined in:
app/controllers/misc_controller.rb

Instance Method Summary collapse

Instance Method Details

#download_infoObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'app/controllers/misc_controller.rb', line 37

def download_info
  fluentd = Fluentd.instance
  path = Rails.root.join("tmp/system_info.zip")
  File.unlink(path) if File.exists?(path)

  Zip::File.open(path, Zip::File::CREATE) do |zip|
    zip.get_output_stream('fluentd.log') {|f| f.puts fluentd.agent.log.read }
    zip.add("fluentd-ui.log", log_path)

    add_env_file_to(zip)
    add_version_file_to(zip)
  end
  send_file path
end

#informationObject



13
14
15
16
# File 'app/controllers/misc_controller.rb', line 13

def information
  @env = ENV
  @plugins = Plugin.installed
end

#showObject



9
10
11
# File 'app/controllers/misc_controller.rb', line 9

def show
  redirect_to misc_information_path
end

#update_fluentd_uiObject



18
19
20
21
# File 'app/controllers/misc_controller.rb', line 18

def update_fluentd_ui
  @current_pid = $$
  render "update_fluentd_ui", layout: "sign_in"
end

#upgrading_statusObject



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/controllers/misc_controller.rb', line 23

def upgrading_status
  if FluentdUiRestartJob::LOCK.present?
    return render text: "updating"
  end

  if $$.to_s == params[:old_pid]
    # restarting fluentd-ui is finished, but PID doesn't changed.
    # maybe error occured at FluentdUiRestart#perform
    render text: "failed"
  else
    render text: "finished"
  end
end