Description of problem: We were trying foreman-tasks-delete from foreman-maintain advanced procedure run with --state as pending/paused/running/stopped. But it always display Invalid state error. Version-Release number of selected component (if applicable): foreman-maintain snap 3 # rpm -q rubygem-foreman_maintain rubygem-foreman_maintain-0.0.10-1.el7sat.noarch How reproducible: always Steps to Reproduce: 1.# foreman-maintain advanced procedure run foreman-tasks-delete --state paused Running ForemanMaintain::Scenario ================================================================================ Delete tasks: / Deleting paused task [FAIL] Invalid State -------------------------------------------------------------------------------- Scenario [ForemanMaintain::Scenario] failed. The following steps ended up in failing state: [foreman-tasks-delete] Resolve the failed steps and rerun the command. In case the failures are false positives, use --whitelist="foreman-tasks-delete" Actual results: FAIL showing Invalid State and Runtime error in foreman-maintain.log I, [2017-10-25 09:16:32-0400 #24695] INFO -- : Running foreman-maintain command with arguments [["advanced", "procedure", "run", "foreman-tasks-delete", "--state", "paused"]] E, [2017-10-25 09:16:32-0400 #24695] ERROR -- : Invalid State (RuntimeError) /usr/share/gems/gems/foreman_maintain-0.0.10/definitions/features/foreman_tasks.rb:87:in `condition' /usr/share/gems/gems/foreman_maintain-0.0.10/definitions/features/foreman_tasks.rb:67:in `count' /usr/share/gems/gems/foreman_maintain-0.0.10/definitions/procedures/foreman_tasks/delete.rb:10:in `block in run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/reporter/cli_reporter.rb:135:in `with_spinner' /usr/share/gems/gems/foreman_maintain-0.0.10/definitions/procedures/foreman_tasks/delete.rb:9:in `run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/executable.rb:118:in `__run__' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner/execution.rb:76:in `block (2 levels) in run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner/execution.rb:99:in `capture_errors' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner/execution.rb:75:in `block in run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner/execution.rb:93:in `with_metadata_calculation' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner/execution.rb:74:in `run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner.rb:108:in `run_step' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner.rb:97:in `run_steps' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner.rb:90:in `execute_scenario_steps' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner.rb:45:in `run_scenario' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner.rb:30:in `block in run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner.rb:29:in `each' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/runner.rb:29:in `run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/cli/base.rb:48:in `run_scenario' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/cli/advanced/procedure/abstract_procedure_command.rb:12:in `execute' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:68:in `run' /usr/share/gems/gems/foreman_maintain-0.0.10/lib/foreman_maintain/cli.rb:21:in `run' /usr/share/gems/gems/clamp-1.0.0/lib/clamp/command.rb:133:in `run' /usr/share/gems/gems/foreman_maintain-0.0.10/bin/foreman-maintain:12:in `<top (required)>' /usr/bin/foreman-maintain:23:in `load' /usr/bin/foreman-maintain:23:in `<main>' Expected results: Additional info:
Created redmine issue http://projects.theforeman.org/issues/21472 from this bug
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/21472 has been resolved.
Attached upstream ticket is not fully serving the purpose of BZ. Using foreman-tasks-delete procedure, we are only deleting below foreman-tasks: 1. Having state - planning/pending and 2. paused/stopped tasks which are older than 30 days. Here, expected possible values are old, planning or pending for --state option. Attaching a upstream bug - http://projects.theforeman.org/issues/21974 and modifying status of this BZ ticket.
Updated outdated Target Milestone.
Closing this since this is not a relevant issue. We do not try to delete paused tasks, we just try to resume them. So, run `foreman-tasks-delete --state paused` should never be run. The only valid values are 'old', 'planning' or 'pending'. With PR ( https://github.com/theforeman/foreman_maintain/pull/132 ) foreman-maintain would validate values passed to --state option and won't throw an error.
Moved to ON_QA as per Anurag's email that this is present from rubygem-foreman_maintain-0.1.4 onwards.
VERIFIED # rpm -qa | grep maintain rubygem-foreman_maintain-0.1.5-1.el7sat.noarch # foreman-maintain advanced procedure run foreman-tasks-delete --state paused 'paused' not allowed for state param. Possible values are old, planning, pending # foreman-maintain advanced procedure run foreman-tasks-delete --state old Running ForemanMaintain::Scenario ================================================================================ Delete tasks: / Deleting old task [OK] -------------------------------------------------------------------------------- # foreman-maintain advanced procedure run foreman-tasks-delete --state planning Running ForemanMaintain::Scenario ================================================================================ Delete tasks: / Deleting planning task [OK] -------------------------------------------------------------------------------- # foreman-maintain advanced procedure run foreman-tasks-delete --state pending Running ForemanMaintain::Scenario ================================================================================ Delete tasks: / Deleting pending task [OK] -------------------------------------------------------------------------------- Error gets properly handled and foreman-tasks-delete procedure working fine with possible values old, planning and pending.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:0633