Bug 1622264

Summary: foreman_tasks:cleanup process, STATES is not working as expected when passing *
Product: Red Hat Satellite Reporter: Waldirio M Pinheiro <wpinheir>
Component: Tasks PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Jan Hutaƙ <jhutar>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.3.2CC: aruzicka, inecas
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-01 08:09:24 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1619394    

Description Waldirio M Pinheiro 2018-08-25 00:15:41 UTC
Description of problem:
When executing foreman-rake to remove tasks, by default will be removed only stopped tasks, using * should be expected to delete everything but it's not.

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

How reproducible:
100%

Steps to Reproduce:
1. Foreman-rake console
2. foreman-rake foreman_tasks:cleanup:run TASK_SEARCH="*" AFTER=1h STATES="*" VERBOSE=true NOOP=true
3. foreman-rake foreman_tasks:cleanup:run TASK_SEARCH="*" AFTER=1h STATES="running" VERBOSE=true NOOP=true

Actual results:
* is not working as expected

Expected results:
* should mean all available states *running, paused, stopped, etc*

Additional info:

Comment 3 Adam Ruzicka 2018-09-03 13:13:16 UTC
I'd say it is working exactly as expected. From the description of the task "comma separated list of task states to touch with the cleanup, by default only stopped tasks are covered". That doesn't suggest that asterisk could be used to match all.

Also to me using an asterisk would imply some kind of glob matching and if we went with that we would also have to extend the support for matching "stopped" and "scheduled" with "s*" and so on.

In foreman-tasks >= 0.10.3 the user can use a special keyword "all" to match against all the states.

Comment 6 Adam Ruzicka 2019-08-01 08:09:24 UTC
Closing this BZ in favor of a better interface for tasks cleanup BZ[1].

[1] - https://bugzilla.redhat.com/show_bug.cgi?id=1723751