Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix host deletion task call #843

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

ShimShtein
Copy link
Member

@chris1984 @jameerpathan111 I think this should fix our deletion task.

Also: the deletion is done only with the scheduled task, so if you want to test it, you have to run it manually from the console:

[2] pry(main)> ENV['SATELLITE_RH_CLOUD_REQUESTS_DELAY'] = '0'
=> "0"
[3] pry(main)> ForemanTasks.sync_task(InventorySync::Async::InventoryScheduledSync)

This will invoke the scheduled update task immediately.

Copy link
Member

@chris1984 chris1984 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK from a dev standpoint, I can see the task being kicked off now:

[1] pry(main)> ENV['SATELLITE_RH_CLOUD_REQUESTS_DELAY'] = '0'
=> "0"
[2] pry(main)> ForemanTasks.sync_task(InventorySync::Async::InventoryScheduledSync)
2023-10-03T11:21:57 [I|bac|] Task {label: , execution_plan_id: 98212650-3cdb-47e7-9772-e707768a85a1} state changed: pending 
2023-10-03T11:21:57 [I|bac|] Task {label: InventorySync::Async::InventoryScheduledSync, id: 74c91183-99fe-4eb9-8831-fa5e771755af, execution_plan_id: 98212650-3cdb-47e7-9772-e707768a85a1} state changed: planning 
2023-10-03T11:21:57 [D|bac|] planning a delay for 0 seconds before the rest of the execution
2023-10-03T11:21:57 [D|kat|] Resource GET request: /candlepin/owners/Default_Organization
2023-10-03T11:21:57 [D|kat|] Headers: {"accept":"application/json","cp-user":"foreman_admin"}
2023-10-03T11:21:57 [D|kat|] Body: null
2023-10-03T11:21:57 [D|kat|] Candlepin request cf7e14aa-5155-45d1-8e5e-421a09b97ceb returned with code 200
2023-10-03T11:21:57 [D|kat|] Processing response: 200
2023-10-03T11:21:57 [D|kat|] {"created":"2023-09-18T17:29:43+0000","updated":"2023-09-20T17:57:07+0000","id":"8a889de08aa94a1c018aa95746e40001","displayName":"Default Organization","key":"Default_Organization","contentPrefix":"/Default_Organization/$env","defaultServiceLevel":null,"logLevel":null,"contentAccessMode":"org_environment","contentAccessModeList":"entitlement,org_environment","autobindHypervisorDisabled":false,"autobindDisabled":false,"lastRefreshed":null,"parentOwner":null,"upstreamConsumer":null}
2023-10-03T11:21:57 [D|bac|] Cloud authentication is not available, skipping inventory hosts sync
2023-10-03T11:21:57 [I|bac|] Task {label: InventorySync::Async::InventoryScheduledSync, id: 74c91183-99fe-4eb9-8831-fa5e771755af, execution_plan_id: 98212650-3cdb-47e7-9772-e707768a85a1} state changed: planned 
2023-10-03T11:21:57 [I|bac|] Task {label: InventorySync::Async::InventoryScheduledSync, id: 74c91183-99fe-4eb9-8831-fa5e771755af, execution_plan_id: 98212650-3cdb-47e7-9772-e707768a85a1} state changed: running 
2023-10-03T11:21:57 [D|bac|] Going to sleep for 0 seconds
2023-10-03T11:21:57 [D|bac|] Waking up
2023-10-03T11:21:57 [I|bac|] Task {label: InventorySync::Async::InventoryScheduledSync, id: 74c91183-99fe-4eb9-8831-fa5e771755af, execution_plan_id: 98212650-3cdb-47e7-9772-e707768a85a1} state changed: stopped  result: success
=> #<ForemanTasks::Task::DynflowTask:0x000056142c861cd0
 id: "74c91183-99fe-4eb9-8831-fa5e771755af",
 type: "ForemanTasks::Task::DynflowTask",
 label: "InventorySync::Async::InventoryScheduledSync",
 started_at: Tue, 03 Oct 2023 15:21:57.126000000 UTC +00:00,
 ended_at: Tue, 03 Oct 2023 15:21:57.345397000 UTC +00:00,
 state: "stopped",
 result: "success",
 external_id: "98212650-3cdb-47e7-9772-e707768a85a1",
 parent_task_id: nil,
 start_at: Tue, 03 Oct 2023 15:21:57.120135000 UTC +00:00,
 start_before: nil,
 action: "Wait and Inventory scheduled sync",
 user_id: 2,
 state_updated_at: Tue, 03 Oct 2023 15:21:57.356186000 UTC +00:00>
[3] pry(main)> 2023-10-03T11:22:04 [I|bac|ea3db03b] Task {label: ForemanInventoryUpload::Async::GenerateAllReportsJob, id: e805727e-5893-41ec-9c7d-0048b1675c29, execution_plan_id: 816a7787-90fe-4dee-8beb-43a58137e912} state changed: planning 
2023-10-03T11:22:04 [I|bac|1ede8e26] Task {label: InsightsCloud::Async::InsightsScheduledSync, id: 67c7b4ab-5083-41a1-a640-77082d4e6094, execution_plan_id: 2dbb196a-dbbe-4bc9-ad82-101b5cb4d147} state changed: planning 
2023-10-03T11:22:04 [I|bac|1de2deb8] Task {label: Actions::CheckLongRunningTasks, id: b50c63aa-a85a-465e-9b54-316dccb94e4f, execution_plan_id: 6dfc06b0-f2a3-463b-9987-9868a9a5548d} state changed: planning 
2023-10-03T11:22:04 [D|bac|1ede8e26] The scheduled process is disabled due to the "allow_auto_insights_sync"
 1ede8e26 |             setting being set to false.
2023-10-03T11:22:04 [D|bac|ea3db03b] planning a delay for 0 seconds before the rest of the execution
2023-10-03T11:22:04 [I|bac|1ede8e26] Task {label: InsightsCloud::Async::InsightsScheduledSync, id: 67c7b4ab-5083-41a1-a640-77082d4e6094, execution_plan_id: 2dbb196a-dbbe-4bc9-ad82-101b5cb4d147} state changed: planned 
2023-10-03T11:22:04 [I|bac|ea3db03b] Task {label: ForemanInventoryUpload::Async::GenerateAllReportsJob, id: e805727e-5893-41ec-9c7d-0048b1675c29, execution_plan_id: 816a7787-90fe-4dee-8beb-43a58137e912} state changed: planned 
2023-10-03T11:22:04 [I|bac|1dfe4438] Task {label: , execution_plan_id: 14838d10-73a8-41a2-a3df-a6d265d4ac3a} state changed: pending 
2023-10-03T11:22:04 [I|app|4a1be4bb] Performing CreateRssNotifications (Job ID: 9f6ba610-6df4-4cba-a76c-016829bb3747) from Dynflow(default) enqueued at 2023-09-28T17:41:32Z with arguments: {}
2023-10-03T11:22:04 [I|bac|1dfe4438] Task {label: InsightsCloud::Async::InsightsScheduledSync, id: 9b6e6f02-651f-4154-84eb-2d63e7be9adb, execution_plan_id: 14838d10-73a8-41a2-a3df-a6d265d4ac3a} state changed: scheduled 
2023-10-03T11:22:04 [I|bac|ab7f606f] Task {label: , execution_plan_id: d41451ec-03fd-473f-8321-6b6e18ed6790} state changed: pending 
2023-10-03T11:22:04 [I|bac|1de2deb8] Task {label: Actions::CheckLongRunningTasks, id: b50c63aa-a85a-465e-9b54-316dccb94e4f, execution_plan_id: 6dfc06b0-f2a3-463b-9987-9868a9a5548d} state changed: planned 
2023-10-03T11:22:04 [I|bac|ab7f606f] Task {label: ForemanInventoryUpload::Async::GenerateAllReportsJob, id: 0ab5837e-f3ce-411f-b040-72827e3642c1, execution_plan_id: d41451ec-03fd-473f-8321-6b6e18ed6790} state changed: scheduled 
2023-10-03T11:22:04 [I|bac|6a14ea6a] Task {label: , execution_plan_id: 11b42b6e-0240-4a6e-a96c-862c2fd00169} state changed: pending 
2023-10-03T11:22:04 [I|bac|6a14ea6a] Task {label: Actions::CheckLongRunningTasks, id: f6e6398f-86b1-49b4-ba9f-0fa16f1bf922, execution_plan_id: 11b42b6e-0240-4a6e-a96c-862c2fd00169} state changed: scheduled 
2023-10-03T11:22:04 [I|bac|ea3db03b] Task {label: ForemanInventoryUpload::Async::GenerateAllReportsJob, id: e805727e-5893-41ec-9c7d-0048b1675c29, execution_plan_id: 816a7787-90fe-4dee-8beb-43a58137e912} state changed: running 
2023-10-03T11:22:04 [D|bac|ea3db03b] Going to sleep for 0 seconds
2023-10-03T11:22:04 [D|bac|ea3db03b] Waking up
2023-10-03T11:22:04 [D|bac|ea3db03b] Starting ForemanInventoryUpload::Async::GenerateReportJob with label report_for_1
2023-10-03T11:22:05 [I|app|4a1be4bb] Enqueued CreateRssNotifications (Job ID: 2d40a8de-fe94-42a8-b477-55045b46416f) to Dynflow(default) at 2023-10-04 03:22:05 UTC with arguments: {}
2023-10-03T11:22:05 [I|app|4a1be4bb] Performed CreateRssNotifications (Job ID: 9f6ba610-6df4-4cba-a76c-016829bb3747) from Dynflow(default) in 775.3ms
2023-10-03T11:22:14 [D|bac|ea3db03b] Finished job ForemanInventoryUpload::Async::GenerateReportJob with label report_for_1
2023-10-03T11:22:14 [D|bac|ea3db03b] Ensuring objects
2023-10-03T11:22:14 [D|bac|ea3db03b] Copying report_for_1.tar.xz to /home/vagrant/foreman/red_hat_inventory/uploads/
2023-10-03T11:22:14 [D|bac|ea3db03b] Done copying report_for_1.tar.xz to /home/vagrant/foreman/red_hat_inventory/uploads/report_for_1.tar.xz
2023-10-03T11:22:14 [W|app|ea3db03b] Setting content_disconnected has no definition, please define it before using
2023-10-03T11:22:14 [D|kat|ea3db03b] Resource GET request: /candlepin/owners/Default_Organization
2023-10-03T11:22:14 [D|kat|ea3db03b] Headers: {"accept":"application/json","cp-user":"foreman_admin"}
2023-10-03T11:22:14 [D|kat|ea3db03b] Body: null
2023-10-03T11:22:14 [D|kat|ea3db03b] Candlepin request 9ff0328e-9a28-4f49-8b9d-957981648e9b returned with code 200
2023-10-03T11:22:14 [D|kat|ea3db03b] Processing response: 200
2023-10-03T11:22:14 [D|kat|ea3db03b] {"created":"2023-09-18T17:29:43+0000","updated":"2023-09-20T17:57:07+0000","id":"8a889de08aa94a1c018aa95746e40001","displayName":"Default Organization","key":"Default_Organization","contentPrefix":"/Default_Organization/$env","defaultServiceLevel":null,"logLevel":null,"contentAccessMode":"org_environment","contentAccessModeList":"entitlement,org_environment","autobindHypervisorDisabled":false,"autobindDisabled":false,"lastRefreshed":null,"parentOwner":null,"upstreamConsumer":null}
2023-10-03T11:22:14 [I|bac|ea3db03b] Skipping organization 'Default Organization', no candlepin certificate defined.
2023-10-03T11:22:14 [I|bac|ea3db03b] Task {label: ForemanInventoryUpload::Async::GenerateAllReportsJob, id: e805727e-5893-41ec-9c7d-0048b1675c29, execution_plan_id: 816a7787-90fe-4dee-8beb-43a58137e912} state changed: stopped  result: success
2023-10-03T11:22:18 [I|bac|b714b2ee] Task {label: InventorySync::Async::InventoryScheduledSync, id: cfd927d9-29f9-44ba-ad6d-faa98db5657f, execution_plan_id: 5097a270-0ef6-4fcb-9f6d-b7c2209c5aa4} state changed: planning 
2023-10-03T11:22:19 [D|bac|b714b2ee] planning a delay for 0 seconds before the rest of the execution
2023-10-03T11:22:19 [D|bac|b714b2ee] Cloud authentication is not available, skipping inventory hosts sync
2023-10-03T11:22:19 [I|bac|b714b2ee] Task {label: InventorySync::Async::InventoryScheduledSync, id: cfd927d9-29f9-44ba-ad6d-faa98db5657f, execution_plan_id: 5097a270-0ef6-4fcb-9f6d-b7c2209c5aa4} state changed: planned 
2023-10-03T11:22:19 [I|bac|da2c8aa5] Task {label: , execution_plan_id: 6f20ac7a-ec36-42ee-88c8-1bc9f6fbb64f} state changed: pending 
2023-10-03T11:22:19 [I|bac|da2c8aa5] Task {label: InventorySync::Async::InventoryScheduledSync, id: 50b38826-f0b1-4193-9e90-9ef503add56a, execution_plan_id: 6f20ac7a-ec36-42ee-88c8-1bc9f6fbb64f} state changed: scheduled 
2023-10-03T11:22:19 [I|app|4a1be4bb] Performing CreateExpiredManifestNotifications (Job ID: d62404dc-7eb5-4118-a09b-081a185dab2e) from Dynflow(default) enqueued at 2023-09-28T17:41:32Z
2023-10-03T11:22:19 [D|kat|4a1be4bb] Resource GET request: /candlepin/owners/Default_Organization
2023-10-03T11:22:19 [D|kat|4a1be4bb] Headers: {"accept":"application/json","cp-user":"foreman_admin"}
2023-10-03T11:22:19 [D|kat|4a1be4bb] Body: null
2023-10-03T11:22:19 [D|kat|4a1be4bb] Candlepin request 9fa96d86-3808-4701-bcde-c16d884a5915 returned with code 200
2023-10-03T11:22:19 [D|kat|4a1be4bb] Processing response: 200
2023-10-03T11:22:19 [D|kat|4a1be4bb] {"created":"2023-09-18T17:29:43+0000","updated":"2023-09-20T17:57:07+0000","id":"8a889de08aa94a1c018aa95746e40001","displayName":"Default Organization","key":"Default_Organization","contentPrefix":"/Default_Organization/$env","defaultServiceLevel":null,"logLevel":null,"contentAccessMode":"org_environment","contentAccessModeList":"entitlement,org_environment","autobindHypervisorDisabled":false,"autobindDisabled":false,"lastRefreshed":null,"parentOwner":null,"upstreamConsumer":null}
2023-10-03T11:22:19 [I|app|4a1be4bb] Enqueued CreateExpiredManifestNotifications (Job ID: fdd29704-496f-4c6f-a75b-6a2a49d853f1) to Dynflow(default) at 2023-10-04 15:22:19 UTC
2023-10-03T11:22:19 [I|app|4a1be4bb] Performed CreateExpiredManifestNotifications (Job ID: d62404dc-7eb5-4118-a09b-081a185dab2e) from Dynflow(default) in 109.34ms

@jameerpathan111 Can you test it on your working setup with a client?

@ShimShtein ShimShtein merged commit c21ed37 into theforeman:foreman_3_7 Oct 4, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants