This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1473606 - Cancelled delayed plans are not picked up by cleaner rake task when using AFTER
Cancelled delayed plans are not picked up by cleaner rake task when using AFTER
Status: NEW
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Tasks Plugin (Show other bugs)
6.2.9
Unspecified Unspecified
medium Severity medium (vote)
: Unspecified
: --
Assigned To: satellite6-bugs
: FieldEngineering, Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-21 05:37 EDT by aruzicka
Modified: 2017-08-02 01:02 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Foreman Issue Tracker 20375 None None None 2017-07-21 05:42 EDT

  None (edit)
Description aruzicka 2017-07-21 05:37:34 EDT
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

# Run your normal cleanup here
# foreman-rake foreman_tasks:cleanup AFTER=$AFTER ...

# 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)"

# Remove the broken leftovers
foreman-rake foreman_tasks:cleanup TASK_SEARCH="null? started_at AND ended_at < \"$TIMESTAMP\""
Comment 1 aruzicka 2017-07-21 05:42:16 EDT
Created redmine issue http://projects.theforeman.org/issues/20375 from this bug

Note You need to log in before you can comment on or make changes to this bug.