From 62cf888d6c0a7d9ea4e16dcdb4d05bf8a79e13bd Mon Sep 17 00:00:00 2001 From: d-m-u Date: Tue, 28 Jan 2020 09:26:11 -0500 Subject: [PATCH] Update the model and dialog log file timestamp to be now --- app/models/miq_server/log_management.rb | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/app/models/miq_server/log_management.rb b/app/models/miq_server/log_management.rb index b9f30c3e2e9f..d509ca1043d2 100644 --- a/app/models/miq_server/log_management.rb +++ b/app/models/miq_server/log_management.rb @@ -109,7 +109,12 @@ def post_one_log_pattern(pattern, logfile, log_type) task = logfile.miq_task log_prefix = "Task: [#{task.id}]" - log_start, log_end = log_start_and_end_for_pattern(pattern) + if %w[Dialogs Models].include?(log_type) + log_start, log_end = logfile.logging_started_on, logfile.logging_ended_on + else + log_start, log_end = log_start_and_end_for_pattern(pattern) + end + date_string = "#{format_log_time(log_start)} #{format_log_time(log_end)}" unless log_start.nil? && log_end.nil? msg = "Zipping and posting #{log_type.downcase} logs for [#{who_am_i}] from: [#{log_start}] to [#{log_end}]" @@ -145,9 +150,13 @@ def post_one_log_pattern(pattern, logfile, log_type) def post_automate_models(taskid, log_depot) domain_zip = Rails.root.join("log", "domain.zip") backup_automate_models(domain_zip) + now = Time.zone.now logfile = LogFile.historical_logfile - logfile.update(:file_depot => log_depot, :miq_task => MiqTask.find(taskid)) + logfile.update(:file_depot => log_depot, + :miq_task => MiqTask.find(taskid), + :logging_started_on => now, + :logging_ended_on => now) post_one_log_pattern(domain_zip, logfile, "Models") ensure FileUtils.rm_rf(domain_zip) @@ -163,9 +172,13 @@ def post_automate_dialogs(taskid, log_depot) dialog_directory = Rails.root.join("log", "service_dialogs") FileUtils.mkdir_p(dialog_directory) backup_automate_dialogs(dialog_directory) + now = Time.zone.now logfile = LogFile.historical_logfile - logfile.update(:file_depot => log_depot, :miq_task => MiqTask.find(taskid)) + logfile.update(:file_depot => log_depot, + :miq_task => MiqTask.find(taskid), + :logging_started_on => now, + :logging_ended_on => now) post_one_log_pattern(dialog_directory.join("*"), logfile, "Dialogs") ensure FileUtils.rm_rf(dialog_directory)