mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 02:46:11 +02:00
Separate fat action
This commit is contained in:
parent
e0f0ccdc3b
commit
8dc2be80ef
@ -18,22 +18,9 @@ class Fluentd::SettingsController < ApplicationController
|
||||
|
||||
def update
|
||||
if params[:dryrun]
|
||||
if dryrun(params[:config])
|
||||
flash.now[:success] = I18n.t('messages.dryrun_is_passed')
|
||||
else
|
||||
flash.now[:danger] = @fluentd.agent.last_error_message
|
||||
end
|
||||
@config = params[:config]
|
||||
render "edit"
|
||||
handle_dryrun
|
||||
else
|
||||
begin
|
||||
update_config(params[:config])
|
||||
redirect_to daemon_setting_path(@fluentd)
|
||||
rescue Fluent::ConfigParseError => e
|
||||
@config = params[:config]
|
||||
flash.now[:danger] = e.message
|
||||
render "edit"
|
||||
end
|
||||
handle_update
|
||||
end
|
||||
end
|
||||
|
||||
@ -48,6 +35,25 @@ class Fluentd::SettingsController < ApplicationController
|
||||
@config = @fluentd.agent.config
|
||||
end
|
||||
|
||||
def handle_dryrun
|
||||
if dryrun(params[:config])
|
||||
flash.now[:success] = I18n.t('messages.dryrun_is_passed')
|
||||
else
|
||||
flash.now[:danger] = @fluentd.agent.last_error_message
|
||||
end
|
||||
@config = params[:config]
|
||||
render "edit"
|
||||
end
|
||||
|
||||
def handle_update
|
||||
update_config(params[:config])
|
||||
redirect_to daemon_setting_path(@fluentd)
|
||||
rescue Fluent::ConfigParseError => e
|
||||
@config = params[:config]
|
||||
flash.now[:danger] = e.message
|
||||
render "edit"
|
||||
end
|
||||
|
||||
def dryrun(conf)
|
||||
tmpfile = Tempfile.open("fluentd-test-config")
|
||||
tmpfile.write params[:config]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user