Class: MiscController

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

Instance Method Summary collapse

Instance Method Details

#download_infoObject



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

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



11
12
13
14
# File 'app/controllers/misc_controller.rb', line 11

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

#showObject



7
8
9
# File 'app/controllers/misc_controller.rb', line 7

def show
  redirect_to misc_information_path
end

#update_fluentd_uiObject



16
17
18
19
# File 'app/controllers/misc_controller.rb', line 16

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

#upgrading_statusObject



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

def upgrading_status
  if FluentdUiRestart::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