From 5de418539fb7ad8449897bcd0f2bb09c01ed3385 Mon Sep 17 00:00:00 2001 From: hassaku Date: Wed, 7 Jan 2015 18:23:15 +0900 Subject: [PATCH] Remove also note file at the same time as removing backup config file. --- app/models/fluentd/agent/local_common.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/fluentd/agent/local_common.rb b/app/models/fluentd/agent/local_common.rb index 14823e4..231d430 100644 --- a/app/models/fluentd/agent/local_common.rb +++ b/app/models/fluentd/agent/local_common.rb @@ -89,8 +89,9 @@ class Fluentd return if over_file_count <= 0 backup_files_in_old_order.first(over_file_count).each do |file| - next unless File.exist? file - FileUtils.rm(file) + note_file_attached_backup = file.sub(/#{Regexp.escape(File.extname(file))}\z/, ::Fluentd::SettingArchive::Note::FILE_EXTENSION) + FileUtils.rm(note_file_attached_backup) if File.exist? note_file_attached_backup + FileUtils.rm(file) if File.exist? file end end