Module: SettingHistoryConcern
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/controllers/concerns/setting_history_concern.rb
Instance Method Summary collapse
Instance Method Details
#configtest ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/concerns/setting_history_concern.rb', line 24 def configtest @fluentd.config_file = @backup_file.file_path if @fluentd.agent.dryrun flash = { success: t('messages.dryrun_is_passed') } else flash = { danger: @fluentd.agent.log.tail(1).first } end redirect_to :back, flash: flash end |
#reuse ⇒ Object
19 20 21 22 |
# File 'app/controllers/concerns/setting_history_concern.rb', line 19 def reuse @fluentd.agent.config_write @backup_file.content redirect_to daemon_setting_path, flash: { success: t('messages.config_successfully_copied', brand: fluentd_ui_brand) } end |
#show ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'app/controllers/concerns/setting_history_concern.rb', line 10 def show current = @fluentd.agent.config target = @backup_file.content if target @sdiff = Diff::LCS.sdiff(current.split("\n").map(&:rstrip), target.split("\n").map(&:rstrip)) @changed = @sdiff.any? { |context_change| context_change.changed? } end end |