From 9ad4d7c63c971592f751e1ff5408cebbae33fe04 Mon Sep 17 00:00:00 2001 From: Partha Aji Date: Thu, 14 Nov 2024 12:18:04 -0500 Subject: [PATCH] Clear shell process log before restart Report regeneration and upload tasks add a lot of logs Since we dont clear logs on every regeneration we have too much outdated logs. This commit wil change that and clear logs before ruinning the report.. --- lib/foreman_inventory_upload/async/shell_process.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/foreman_inventory_upload/async/shell_process.rb b/lib/foreman_inventory_upload/async/shell_process.rb index 92b269d5..e4124137 100644 --- a/lib/foreman_inventory_upload/async/shell_process.rb +++ b/lib/foreman_inventory_upload/async/shell_process.rb @@ -7,6 +7,7 @@ class ShellProcess < ::Actions::EntryAction include ::ForemanRhCloud::Async::ExponentialBackoff def plan(instance_label, more_inputs = {}) + clear_task_output(instance_label) inputs = more_inputs.merge(instance_label: instance_label) plan_self(inputs) end @@ -53,6 +54,11 @@ def rescue_strategy_for_self Dynflow::Action::Rescue::Fail end + def clear_task_output(label) + TaskOutputLine.where(label: label).delete_all + TaskOutputStatus.where(label: label).delete_all + end + private def preprocess_command(command)