Project

General

Profile

Actions

Bug #20375

open

Cancelled delayed plans are not picked up by cleaner rake task when using AFTER

Added by Adam Ruzicka almost 7 years ago. Updated almost 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Foreman plugin
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1473606

Description of problem:
When trying to remove cancelled delayed plans using the foreman_tasks:cleanup AFTER=$AFTER, it will skip those plans because they don't have started_at field set.

Version-Release number of selected component (if applicable):

How reproducible:
Always

Steps to Reproduce:
1. Schedule remote execution job to be executed in the future
2. Go to its task and click cancel
3. Observe task flipping over to stopped-error
5. Run foreman-rake foreman_tasks:cleanup AFTER='10s'

Actual results:
The task remains there

Expected results:
The task is deleted

Additional info:

Workaround:
Modify your cleanup cronjob/script to look like this

AFTER='30d' # Set desired time interval here

  1. Run your normal cleanup here
  2. foreman-rake foreman_tasks:cleanup AFTER=$AFTER ...
  1. Let the cleanup task compute the right cutoff date
    TIMESTAMP="$(foreman-rake foreman_tasks:cleanup TASK_SEARCH='label != a_label' NOOP=true AFTER="$AFTER" | grep 'all tasks matching' | grep P -o "\d\d\d\d\d\d-\d\d \d\d:\d\d:\d\d" | tail -n1)"
  1. Remove the broken leftovers
    foreman-rake foreman_tasks:cleanup TASK_SEARCH="null? started_at AND ended_at < \"$TIMESTAMP\""
Actions #1

Updated by Adam Ruzicka almost 7 years ago

  • Category set to Foreman plugin
  • Target version set to 113

Please see the BZ for the workaround, redmine obviously tries to render it as markdown or something

Actions

Also available in: Atom PDF