Class: Fluentd::Settings::InTailController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Fluentd::Settings::InTailController
- Defined in:
- app/controllers/fluentd/settings/in_tail_controller.rb
Instance Method Summary collapse
Instance Method Details
#after_file_choose ⇒ Object
5 6 7 8 9 10 |
# File 'app/controllers/fluentd/settings/in_tail_controller.rb', line 5 def after_file_choose @setting = Fluentd::Setting::InTail.new({ :path => params[:path], :tag => nil, }) end |
#after_format ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'app/controllers/fluentd/settings/in_tail_controller.rb', line 12 def after_format # NOTE: pos_file form field doesn't exists before this action attrs = setting_params if attrs[:pos_file].blank? attrs.merge!(pos_file: "/tmp/fluentd-#{@fluentd.id}-#{Time.now.to_i}.pos") end @setting = Fluentd::Setting::InTail.new(attrs) end |
#confirm ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'app/controllers/fluentd/settings/in_tail_controller.rb', line 21 def confirm @setting = Fluentd::Setting::InTail.new(setting_params) if params[:back] return render :after_file_choose end unless @setting.valid? return render :after_format end end |
#finish ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'app/controllers/fluentd/settings/in_tail_controller.rb', line 31 def finish @setting = Fluentd::Setting::InTail.new(setting_params) if params[:back] return render :after_format end unless @setting.valid? return render "after_format" end if @fluentd.agent.configuration.to_s.include?(@setting.to_conf.strip) @setting.errors.add(:base, :duplicated_conf) return render "after_format" end @fluentd.agent.config_append @setting.to_conf @fluentd.agent.restart if @fluentd.agent.running? redirect_to daemon_setting_path(@fluentd) end |