Skip to content

Commit

Permalink
Clear shell process log before restart
Browse files Browse the repository at this point in the history
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..
  • Loading branch information
parthaa committed Nov 14, 2024
1 parent 48f9d74 commit 9ad4d7c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/foreman_inventory_upload/async/shell_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 9ad4d7c

Please sign in to comment.