Bug #37880
closed"Remove package" action returns 0 but yum returns 1 -> REX job appears successful but command fails
Description
Tested on Foreman 3.12.0/Katello 4.14.0 on Rocky Linux 9.4 with foreman_remote_execution 13.2.5
reproducer
1. go to hosts > all hosts
2. select a host (example: CentOS Stream 9)
3. on the content tab, click the packages tab
4. select a package that you want to remove (test with a package that you cannot remove such as "basesystem")
5. after the REX job starts, click on the link in the top right corner
result: REX job is green
expected result: REX job is red if yum returns 1
production.log
2024-10-04T15:36:02 [I|app|9c25917e] Started POST "/api/v2/job_invocations" for 172.16.1.25 at 2024-10-04 15:36:02 +0200 2024-10-04T15:36:02 [I|app|9c25917e] Processing by Api::V2::JobInvocationsController#create as JSON 2024-10-04T15:36:02 [I|app|9c25917e] Parameters: {"job_invocation"=>{"feature"=>"katello_packages_remove_by_search", "inputs"=>{"Packages search query"=>"id ^ (1970)"}, "description_format"=>"Remove package(s) basesystem", "search_query"=>"name ^ (fm-c9.example.com)"}, "apiv"=>"v2"} 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on job_category Katello 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on description Remove package(s) basesystem 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on concurrency_level 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on execution_timeout_interval 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on password [redacted] 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on key_passphrase 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on remote_execution_feature_id 21 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on effective_user_password 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on ssh_user 2024-10-04T15:36:02 [I|aud|9c25917e] JobInvocation (806) create event on time_to_pickup 2024-10-04T15:36:03 [I|bac|9c25917e] Task {label: , execution_plan_id: b606a870-cadc-47de-a027-0c689ff0c96f} state changed: pending 2024-10-04T15:36:03 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostsJob, id: ea3d99b1-2ad6-41c8-96ba-d92441758e5a, execution_plan_id: b606a870-cadc-47de-a027-0c689ff0c96f} state changed: planning 2024-10-04T15:36:03 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostsJob, id: ea3d99b1-2ad6-41c8-96ba-d92441758e5a, execution_plan_id: b606a870-cadc-47de-a027-0c689ff0c96f} state changed: planned 2024-10-04T15:36:03 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostsJob, id: ea3d99b1-2ad6-41c8-96ba-d92441758e5a, execution_plan_id: b606a870-cadc-47de-a027-0c689ff0c96f} state changed: running 2024-10-04T15:36:03 [I|app|9c25917e] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/api/v2/job_invocations/create.json.rabl (Duration: 94.2ms | Allocations: 19246) 2024-10-04T15:36:03 [I|app|9c25917e] Completed 201 Created in 1849ms (Views: 97.1ms | ActiveRecord: 1114.6ms | Allocations: 119037) 2024-10-04T15:36:04 [I|app|e294ac94] Started GET "/api/v2/job_invocations/806" for 172.16.1.25 at 2024-10-04 15:36:04 +0200 2024-10-04T15:36:04 [I|app|e294ac94] Processing by Api::V2::JobInvocationsController#show as JSON 2024-10-04T15:36:04 [I|app|e294ac94] Parameters: {"apiv"=>"v2", "id"=>"806"} 2024-10-04T15:36:04 [I|app|e294ac94] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/api/v2/job_invocations/show.json.rabl (Duration: 59.0ms | Allocations: 15183) 2024-10-04T15:36:04 [I|app|e294ac94] Completed 200 OK in 88ms (Views: 53.8ms | ActiveRecord: 11.1ms | Allocations: 21987) 2024-10-04T15:36:04 [I|bac|9c25917e] Task {label: , execution_plan_id: 4653bfeb-5bdf-48e0-8495-ccc73112458d} state changed: pending 2024-10-04T15:36:04 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostJob, id: 499f0097-4336-4dc9-84c4-50f56e472a52, execution_plan_id: 4653bfeb-5bdf-48e0-8495-ccc73112458d} state changed: planning 2024-10-04T15:36:05 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostJob, id: 499f0097-4336-4dc9-84c4-50f56e472a52, execution_plan_id: 4653bfeb-5bdf-48e0-8495-ccc73112458d} state changed: planned 2024-10-04T15:36:05 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostJob, id: 499f0097-4336-4dc9-84c4-50f56e472a52, execution_plan_id: 4653bfeb-5bdf-48e0-8495-ccc73112458d} state changed: running 2024-10-04T15:36:05 [I|app|50abb08b] Started GET "/api/v2/job_invocations/806" for 172.16.1.25 at 2024-10-04 15:36:05 +0200 2024-10-04T15:36:05 [I|app|50abb08b] Processing by Api::V2::JobInvocationsController#show as JSON 2024-10-04T15:36:05 [I|app|50abb08b] Parameters: {"apiv"=>"v2", "id"=>"806"} 2024-10-04T15:36:05 [I|app|50abb08b] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/api/v2/job_invocations/show.json.rabl (Duration: 38.8ms | Allocations: 8926) 2024-10-04T15:36:05 [I|app|50abb08b] Completed 200 OK in 66ms (Views: 34.1ms | ActiveRecord: 10.9ms | Allocations: 15359) 2024-10-04T15:36:06 [I|app|8005fbc6] Started GET "/api/v2/job_invocations/806" for 172.16.1.25 at 2024-10-04 15:36:06 +0200 2024-10-04T15:36:06 [I|app|8005fbc6] Processing by Api::V2::JobInvocationsController#show as JSON 2024-10-04T15:36:06 [I|app|8005fbc6] Parameters: {"apiv"=>"v2", "id"=>"806"} 2024-10-04T15:36:06 [I|app|8005fbc6] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/api/v2/job_invocations/show.json.rabl (Duration: 41.7ms | Allocations: 8582) 2024-10-04T15:36:06 [I|app|8005fbc6] Completed 200 OK in 73ms (Views: 34.6ms | ActiveRecord: 13.9ms | Allocations: 15008) 2024-10-04T15:36:06 [I|app|dd836563] Started GET "/job_invocations/806/" for 172.16.1.25 at 2024-10-04 15:36:06 +0200 2024-10-04T15:36:06 [I|app|dd836563] Processing by JobInvocationsController#show as HTML 2024-10-04T15:36:06 [I|app|dd836563] Parameters: {"id"=>"806"} 2024-10-04T15:36:07 [I|app|dbada81d] Started GET "/api/v2/job_invocations/806" for 172.16.1.25 at 2024-10-04 15:36:07 +0200 2024-10-04T15:36:07 [I|app|dbada81d] Processing by Api::V2::JobInvocationsController#show as JSON 2024-10-04T15:36:07 [I|app|dbada81d] Parameters: {"apiv"=>"v2", "id"=>"806"} 2024-10-04T15:36:07 [I|app|dd836563] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/job_invocations/show.html.erb within layouts/application (Duration: 236.9ms | Allocations: 38764) 2024-10-04T15:36:07 [I|app|dd836563] Rendered layouts/base.html.erb (Duration: 42.6ms | Allocations: 20842) 2024-10-04T15:36:07 [I|app|dd836563] Rendered layout layouts/application.html.erb (Duration: 280.8ms | Allocations: 59923) 2024-10-04T15:36:07 [I|app|dd836563] Completed 200 OK in 351ms (Views: 201.8ms | ActiveRecord: 94.9ms | Allocations: 71612) 2024-10-04T15:36:07 [I|app|dbada81d] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/api/v2/job_invocations/show.json.rabl (Duration: 89.1ms | Allocations: 18700) 2024-10-04T15:36:07 [I|app|dbada81d] Completed 200 OK in 164ms (Views: 76.2ms | ActiveRecord: 45.0ms | Allocations: 34115) 2024-10-04T15:36:07 [I|app|58d543c9] Started GET "/rhsm/consumers/c7ebf81a-74f1-47c1-b087-17f684ea35bc/certificates/serials" for 192.168.185.72 at 2024-10-04 15:36:07 +0200 2024-10-04T15:36:07 [I|app|58d543c9] Processing by Katello::Api::Rhsm::CandlepinProxiesController#serials as JSON 2024-10-04T15:36:07 [I|app|58d543c9] Parameters: {"id"=>"c7ebf81a-74f1-47c1-b087-17f684ea35bc"} 2024-10-04T15:36:07 [I|app|d8b38e76] Started GET "/notification_recipients" for 172.16.1.25 at 2024-10-04 15:36:07 +0200 2024-10-04T15:36:07 [I|app|d8b38e76] Processing by NotificationRecipientsController#index as JSON 2024-10-04T15:36:07 [I|app|d8b38e76] Completed 200 OK in 13ms (Views: 0.3ms | ActiveRecord: 2.0ms | Allocations: 2650) 2024-10-04T15:36:08 [I|app|29afd658] Started GET "/api/v2/job_invocations/806" for 172.16.1.25 at 2024-10-04 15:36:08 +0200 2024-10-04T15:36:08 [I|app|29afd658] Processing by Api::V2::JobInvocationsController#show as JSON 2024-10-04T15:36:08 [I|app|29afd658] Parameters: {"apiv"=>"v2", "id"=>"806"} 2024-10-04T15:36:08 [I|app|f642fa91] Started GET "/notification_recipients" for 172.16.1.25 at 2024-10-04 15:36:08 +0200 2024-10-04T15:36:08 [I|app|f642fa91] Processing by NotificationRecipientsController#index as JSON 2024-10-04T15:36:08 [I|app|f642fa91] Completed 200 OK in 19ms (Views: 0.2ms | ActiveRecord: 7.5ms | Allocations: 2539) 2024-10-04T15:36:08 [I|app|29afd658] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/api/v2/job_invocations/show.json.rabl (Duration: 134.7ms | Allocations: 8666) 2024-10-04T15:36:08 [I|app|29afd658] Completed 200 OK in 169ms (Views: 108.6ms | ActiveRecord: 38.3ms | Allocations: 15105) 2024-10-04T15:36:09 [I|app|57124c7a] Started GET "/job_invocations/806?_=1728048967649" for 172.16.1.25 at 2024-10-04 15:36:09 +0200 2024-10-04T15:36:09 [I|app|57124c7a] Processing by JobInvocationsController#show as JS 2024-10-04T15:36:09 [I|app|57124c7a] Parameters: {"_"=>"1728048967649", "id"=>"806"} 2024-10-04T15:36:09 [I|app|57124c7a] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/job_invocations/show.js.erb (Duration: 137.1ms | Allocations: 9932) 2024-10-04T15:36:09 [I|app|57124c7a] Completed 200 OK in 290ms (Views: 156.0ms | ActiveRecord: 26.1ms | Allocations: 23760) 2024-10-04T15:36:10 [I|app|01eed669] Started GET "/job_invocations/806?hosts_needs_refresh=&_=1728048967650" for 172.16.1.25 at 2024-10-04 15:36:10 +0200 2024-10-04T15:36:10 [I|app|01eed669] Processing by JobInvocationsController#show as JS 2024-10-04T15:36:10 [I|app|01eed669] Parameters: {"hosts_needs_refresh"=>"", "_"=>"1728048967650", "id"=>"806"} 2024-10-04T15:36:10 [I|app|01eed669] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/job_invocations/show.js.erb (Duration: 106.2ms | Allocations: 9744) 2024-10-04T15:36:10 [I|app|01eed669] Completed 200 OK in 241ms (Views: 97.1ms | ActiveRecord: 16.7ms | Allocations: 18397) 2024-10-04T15:36:11 [I|app|58d543c9] Completed 200 OK in 4240ms (Views: 0.5ms | ActiveRecord: 5.4ms | Allocations: 7323) 2024-10-04T15:36:11 [I|app|22bde211] Started GET "/rhsm/status" for 192.168.185.72 at 2024-10-04 15:36:11 +0200 2024-10-04T15:36:11 [I|app|22bde211] Processing by Katello::Api::Rhsm::CandlepinProxiesController#server_status as JSON 2024-10-04T15:36:11 [I|app|22bde211] Completed 200 OK in 43ms (Views: 1.0ms | ActiveRecord: 2.3ms | Allocations: 4734) 2024-10-04T15:36:11 [I|app|fdb878c3] Started GET "/rhsm/consumers/c7ebf81a-74f1-47c1-b087-17f684ea35bc/accessible_content" for 192.168.185.72 at 2024-10-04 15:36:11 +0200 2024-10-04T15:36:11 [I|app|fdb878c3] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON 2024-10-04T15:36:11 [I|app|fdb878c3] Parameters: {"id"=>"c7ebf81a-74f1-47c1-b087-17f684ea35bc"} 2024-10-04T15:36:11 [I|app|fdb878c3] Completed 304 Not Modified in 126ms (Views: 0.3ms | ActiveRecord: 2.7ms | Allocations: 5329) 2024-10-04T15:36:12 [I|app|bcd10459] Started GET "/rhsm/" for 192.168.185.72 at 2024-10-04 15:36:12 +0200 2024-10-04T15:36:12 [I|app|bcd10459] Processing by Katello::Api::V2::RootController#rhsm_resource_list as JSON 2024-10-04T15:36:12 [I|app|bcd10459] Parameters: {"root"=>{}} 2024-10-04T15:36:12 [I|app|bcd10459] Completed 200 OK in 19ms (Views: 1.4ms | ActiveRecord: 1.5ms | Allocations: 10243) 2024-10-04T15:36:12 [I|app|bbcf4560] Started GET "/rhsm/consumers/c7ebf81a-74f1-47c1-b087-17f684ea35bc/content_overrides" for 192.168.185.72 at 2024-10-04 15:36:12 +0200 2024-10-04T15:36:12 [I|app|bbcf4560] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON 2024-10-04T15:36:12 [I|app|bbcf4560] Parameters: {"id"=>"c7ebf81a-74f1-47c1-b087-17f684ea35bc"} 2024-10-04T15:36:12 [I|app|609970f4] Started GET "/job_invocations/806?hosts_needs_refresh=&_=1728048967651" for 172.16.1.25 at 2024-10-04 15:36:12 +0200 2024-10-04T15:36:12 [I|app|609970f4] Processing by JobInvocationsController#show as JS 2024-10-04T15:36:12 [I|app|609970f4] Parameters: {"hosts_needs_refresh"=>"", "_"=>"1728048967651", "id"=>"806"} 2024-10-04T15:36:12 [I|app|bbcf4560] Completed 200 OK in 270ms (Views: 0.3ms | ActiveRecord: 1.7ms | Allocations: 4944) 2024-10-04T15:36:12 [I|app|231e9a0a] Started GET "/rhsm/consumers/c7ebf81a-74f1-47c1-b087-17f684ea35bc/owner" for 192.168.185.72 at 2024-10-04 15:36:12 +0200 2024-10-04T15:36:12 [I|app|231e9a0a] Processing by Katello::Api::Rhsm::CandlepinProxiesController#get as JSON 2024-10-04T15:36:12 [I|app|231e9a0a] Parameters: {"id"=>"c7ebf81a-74f1-47c1-b087-17f684ea35bc"} 2024-10-04T15:36:12 [I|app|231e9a0a] Completed 200 OK in 63ms (Views: 0.3ms | ActiveRecord: 2.0ms | Allocations: 4934) 2024-10-04T15:36:12 [I|app|609970f4] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/job_invocations/show.js.erb (Duration: 47.4ms | Allocations: 9747) 2024-10-04T15:36:12 [I|app|609970f4] Completed 200 OK in 370ms (Views: 38.5ms | ActiveRecord: 33.8ms | Allocations: 18406) 2024-10-04T15:36:13 [I|app|6b32b4e5] Started POST "/foreman_tasks/api/tasks/callback" for 192.168.185.5 at 2024-10-04 15:36:13 +0200 2024-10-04T15:36:13 [I|app|6b32b4e5] Processing by ForemanTasks::Api::TasksController#callback as HTML 2024-10-04T15:36:13 [I|app|6b32b4e5] Parameters: {"callback"=>{"task_id"=>"499f0097-4336-4dc9-84c4-50f56e472a52", "step_id"=>3}, "data"=>{"result"=>[{"output_type"=>"stdout", "output"=>"Updating Subscription Management repositories.\n", "timestamp"=>1728048967.7177746}, {"output_type"=>"stdout", "output"=>"Error: \n Problem: The operation would result in removing the following protected packages: grub2-tools-minimal\n(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)\nPackage action failed, exiting...\n", "timestamp"=>1728048973.1444917}], "runner_id"=>"c073b73a-170c-4593-a926-5cd70a78abf7", "exit_status"=>0}, "task"=>{}} 2024-10-04T15:36:13 [I|app|6b32b4e5] Completed 200 OK in 19ms (Views: 0.3ms | ActiveRecord: 4.5ms | Allocations: 3217) 2024-10-04T15:36:13 [I|bac|9c25917e] Event delivered by request 6b32b4e5-fb5c-4b97-ad73-9289a5dabd42 2024-10-04T15:36:13 [I|app|4e3a6458] Started GET "/job_invocations/806?hosts_needs_refresh=&_=1728048967652" for 172.16.1.25 at 2024-10-04 15:36:13 +0200 2024-10-04T15:36:13 [I|app|4e3a6458] Processing by JobInvocationsController#show as JS 2024-10-04T15:36:13 [I|app|4e3a6458] Parameters: {"hosts_needs_refresh"=>"", "_"=>"1728048967652", "id"=>"806"} 2024-10-04T15:36:13 [I|app|4e3a6458] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/job_invocations/show.js.erb (Duration: 40.8ms | Allocations: 9744) 2024-10-04T15:36:13 [I|app|4e3a6458] Completed 200 OK in 78ms (Views: 35.2ms | ActiveRecord: 12.1ms | Allocations: 18398) 2024-10-04T15:36:13 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostJob, id: 499f0097-4336-4dc9-84c4-50f56e472a52, execution_plan_id: 4653bfeb-5bdf-48e0-8495-ccc73112458d} state changed: stopped result: success 2024-10-04T15:36:14 [I|app|9f34cf55] Started GET "/job_invocations/806/" for 172.16.1.25 at 2024-10-04 15:36:14 +0200 2024-10-04T15:36:14 [I|app|9f34cf55] Processing by JobInvocationsController#show as HTML 2024-10-04T15:36:14 [I|app|9f34cf55] Parameters: {"id"=>"806"} 2024-10-04T15:36:14 [I|app|9f34cf55] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/job_invocations/show.html.erb within layouts/application (Duration: 108.0ms | Allocations: 23660) 2024-10-04T15:36:14 [I|app|9f34cf55] Rendered layouts/base.html.erb (Duration: 51.8ms | Allocations: 20542) 2024-10-04T15:36:14 [I|app|9f34cf55] Rendered layout layouts/application.html.erb (Duration: 161.0ms | Allocations: 44474) 2024-10-04T15:36:20 [I|bac|9c25917e] Task {label: Actions::RemoteExecution::RunHostsJob, id: ea3d99b1-2ad6-41c8-96ba-d92441758e5a, execution_plan_id: b606a870-cadc-47de-a027-0c689ff0c96f} state changed: stopped result: success 2024-10-04T15:36:23 [I|app|072a426b] Processing by TemplateInvocationsController#show as HTML 2024-10-04T15:36:23 [I|app|072a426b] Parameters: {"id"=>"1552"} 2024-10-04T15:36:24 [W|app|072a426b] Scoped order is ignored, it's forced to be batch order. 2024-10-04T15:36:24 [I|app|072a426b] Rendered /usr/share/gems/gems/foreman_remote_execution-13.2.5/app/views/template_invocations/show.html.erb within layouts/application (Duration: 92.2ms | Allocations: 15572) 2024-10-04T15:36:24 [I|app|072a426b] Rendered layouts/base.html.erb (Duration: 44.0ms | Allocations: 20814) 2024-10-04T15:36:24 [I|app|072a426b] Rendered layout layouts/application.html.erb (Duration: 139.4ms | Allocations: 37344)
screenshots : see attachments
additional info : if you remove an optional package (eg. nano) that does not break Yum, then the exit is still 0 as expected and REX job succeeds.
Files
Updated by Adam Ruzicka about 2 months ago
- Is duplicate of Bug #37869: Script push ignores exit status and always appears successful added
Updated by Adam Ruzicka about 2 months ago
- Status changed from New to Duplicate
This should be just a symptom of https://projects.theforeman.org/issues/37869 . I'll go ahead and close this, if I misread things and the two bugs are unrelated, feel free to reopen.