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

Fixes #37237 - Allow repairing content view versions #10923

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

sjha4
Copy link
Member

@sjha4 sjha4 commented Mar 8, 2024

What are the changes introduced in this pull request?

  1. Add an API endpoint for verify_checksum on CV versions
  2. Add actions to support CV version repository repairs

Considerations taken when implementing this change?

This action will only be allowed via API/Hammer.
No UI implementation becuase this is not a regular workflow action users should be running. Only for fixing corrupted content on FS.

What are the testing steps for this pull request?

In foreman console: (Note :id to be replaced with a CV version id)

cvv = Katello::ContentViewVersion.find(:id)
ForemanTasks.sync_task(::Actions::Katello::ContentViewVersion::VerifyChecksum, cvv)

If Katello/hammer-cli-katello#932 is merged, or you check it out on hammer,
Follow steps there to verify hammer calls to the API.

@sjha4 sjha4 force-pushed the cv_version_repair branch from cb0f975 to fdabd15 Compare March 8, 2024 15:59
@chris1984 chris1984 self-assigned this Mar 8, 2024
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, code looks fine and it works well.

[2] pry(main)> ForemanTasks.sync_task(::Actions::Katello::ContentViewVersion::VerifyChecksum, cvv)

2024-03-08T13:24:07 [I|bac|] Task {label: , execution_plan_id: 06b84611-06a0-4b2e-9b6a-f19098519a77} state changed: pending
2024-03-08T13:24:07 [I|bac|] Task {label: Actions::Katello::ContentViewVersion::VerifyChecksum, id: 5a3fefd0-3e86-486c-a817-903e84f92133, execution_plan_id: 06b84611-06a0-4b2e-9b6a-f19098519a77} state changed: planning
2024-03-08T13:24:07 [I|bac|] Task {label: Actions::Katello::ContentViewVersion::VerifyChecksum, id: 5a3fefd0-3e86-486c-a817-903e84f92133, execution_plan_id: 06b84611-06a0-4b2e-9b6a-f19098519a77} state changed: planned
2024-03-08T13:24:08 [I|bac|] Task {label: Actions::Katello::Repository::VerifyChecksum, id: d89fb91d-fd00-4a9b-a704-2aee121d86b2, execution_plan_id: 74c8c420-c1b6-4bba-8cfe-4d2ea61f8c6e} state changed: running
2024-03-08T13:24:08 [D|kat|] Calling API: RepositoriesRpmVersionsApi.repair ...
2024-03-08T13:24:08 [D|kat|] HTTP request body param ~BEGIN~
 | {"verify_checksums":true}
 | ~END~
 |
2024-03-08T13:24:08 [D|kat|] HTTP response body ~BEGIN~
 | {"task":"/pulp/api/v3/tasks/018e1f4e-e67e-78a1-a683-12688387bf19/"}
 | ~END~
 |
2024-03-08T13:24:08 [D|kat|] API called: RepositoriesRpmVersionsApi#repair
 | Data: #<PulpRpmClient::AsyncOperationResponse:0x000055b3768dda18 @task="/pulp/api/v3/tasks/018e1f4e-e67e-78a1-a683-12688387bf19/">
 | Status code: 202
 | Headers: {"Date"=>"Fri, 08 Mar 2024 18:24:08 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"POST, OPTIONS", "X-Frame-Options"=>"DENY", "Content-Length"=>"67", "X-Content-Type-Options"=>"nosniff", "Referrer-Policy"=>"same-origin", "Cross-Origin-Opener-Policy"=>"same-origin", "Correlation-ID"=>"83191a951857413ea803a879fa6e74bc", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 devel.croberts.io"}
2024-03-08T13:24:08 [D|kat|] Calling API: TasksApi.read ...
2024-03-08T13:24:08 [D|kat|] HTTP response body ~BEGIN~
 | {"pulp_href":"/pulp/api/v3/tasks/018e1f4e-e67e-78a1-a683-12688387bf19/","pulp_created":"2024-03-08T18:24:08.318747Z","state":"waiting","name":"pulpcore.app.tasks.repository.repair_version","logging_cid":"83191a951857413ea803a879fa6e74bc","created_by":"/pulp/api/v3/users/1/","started_at":null,"finished_at":null,"error":null,"worker":"/pulp/api/v3/workers/018e1f40-d921-765d-8c4c-975b4de23f6d/","parent_task":null,"child_tasks":[],"task_group":null,"progress_reports":[],"created_resources":[],"reserved_resources_record":["shared:/pulp/api/v3/repositories/rpm/rpm/018df701-badf-7afc-a5e1-2f56f3ef63e4/","shared:/pulp/api/v3/domains/018df1ff-04b9-7ad2-9042-e6585ef93ad7/"]}
 | ~END~
 |
2024-03-08T13:24:08 [D|kat|] API called: TasksApi#read
 | Data: #<PulpcoreClient::TaskResponse:0x000055b3768466b8 @pulp_href="/pulp/api/v3/tasks/018e1f4e-e67e-78a1-a683-12688387bf19/", @pulp_created=Fri, 08 Mar 2024 18:24:08 +0000, @state="waiting", @name="pulpcore.app.tasks.repository.repair_version", @logging_cid="83191a951857413ea803a879fa6e74bc", @created_by="/pulp/api/v3/users/1/", @worker="/pulp/api/v3/workers/018e1f40-d921-765d-8c4c-975b4de23f6d/", @child_tasks=[], @progress_reports=[], @created_resources=[], @reserved_resources_record=["shared:/pulp/api/v3/repositories/rpm/rpm/018df701-badf-7afc-a5e1-2f56f3ef63e4/", "shared:/pulp/api/v3/domains/018df1ff-04b9-7ad2-9042-e6585ef93ad7/"]>
 | Status code: 200
 | Headers: {"Date"=>"Fri, 08 Mar 2024 18:24:08 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"GET, PATCH, DELETE, HEAD, OPTIONS", "X-Frame-Options"=>"DENY", "Content-Length"=>"673", "X-Content-Type-Options"=>"nosniff", "Referrer-Policy"=>"same-origin", "Cross-Origin-Opener-Policy"=>"same-origin", "Correlation-ID"=>"a50a801fdd0d4ed6ad09375f375338dc", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 devel.croberts.io"}
2024-03-08T13:24:09 [D|kat|] Calling API: TasksApi.read ...
2024-03-08T13:24:09 [D|kat|] HTTP response body ~BEGIN~
 | {"pulp_href":"/pulp/api/v3/tasks/018e1f4e-e67e-78a1-a683-12688387bf19/","pulp_created":"2024-03-08T18:24:08.318747Z","state":"completed","name":"pulpcore.app.tasks.repository.repair_version","logging_cid":"83191a951857413ea803a879fa6e74bc","created_by":"/pulp/api/v3/users/1/","started_at":"2024-03-08T18:24:08.491098Z","finished_at":"2024-03-08T18:24:08.711121Z","error":null,"worker":"/pulp/api/v3/workers/018e1f40-d921-765d-8c4c-975b4de23f6d/","parent_task":null,"child_tasks":[],"task_group":null,"progress_reports":[{"message":"Repair corrupted units","code":"repair.repaired","state":"completed","total":null,"done":0,"suffix":null},{"message":"Identify corrupted units","code":"repair.corrupted","state":"completed","total":null,"done":0,"suffix":null},{"message":"Identify missing units","code":"repair.missing","state":"completed","total":null,"done":0,"suffix":null}],"created_resources":[],"reserved_resources_record":["shared:/pulp/api/v3/repositories/rpm/rpm/018df701-badf-7afc-a5e1-2f56f3ef63e4/","shared:/pulp/api/v3/domains/018df1ff-04b9-7ad2-9042-e6585ef93ad7/"]}
 | ~END~
 |
2024-03-08T13:24:09 [D|kat|] API called: TasksApi#read
 | Data: #<PulpcoreClient::TaskResponse:0x000055b3761297b8 @pulp_href="/pulp/api/v3/tasks/018e1f4e-e67e-78a1-a683-12688387bf19/", @pulp_created=Fri, 08 Mar 2024 18:24:08 +0000, @state="completed", @name="pulpcore.app.tasks.repository.repair_version", @logging_cid="83191a951857413ea803a879fa6e74bc", @created_by="/pulp/api/v3/users/1/", @worker="/pulp/api/v3/workers/018e1f40-d921-765d-8c4c-975b4de23f6d/", @child_tasks=[], @progress_reports=[#<PulpcoreClient::ProgressReportResponse:0x000055b3761197f0 @message="Repair corrupted units", @code="repair.repaired", @state="completed", @done=0>, #<PulpcoreClient::ProgressReportResponse:0x000055b37610fd40 @message="Identify corrupted units", @code="repair.corrupted", @state="completed", @done=0>, #<PulpcoreClient::ProgressReportResponse:0x000055b37610ec38 @message="Identify missing units", @code="repair.missing", @state="completed", @done=0>], @created_resources=[], @reserved_resources_record=["shared:/pulp/api/v3/repositories/rpm/rpm/018df701-badf-7afc-a5e1-2f56f3ef63e4/", "shared:/pulp/api/v3/domains/018df1ff-04b9-7ad2-9042-e6585ef93ad7/"], @started_at=Fri, 08 Mar 2024 18:24:08 +0000, @finished_at=Fri, 08 Mar 2024 18:24:08 +0000>
 | Status code: 200
 | Headers: {"Date"=>"Fri, 08 Mar 2024 18:24:09 GMT", "Server"=>"gunicorn", "Content-Type"=>"application/json", "Vary"=>"Accept,Cookie", "Allow"=>"GET, PATCH, DELETE, HEAD, OPTIONS", "X-Frame-Options"=>"DENY", "Content-Length"=>"1080", "X-Content-Type-Options"=>"nosniff", "Referrer-Policy"=>"same-origin", "Cross-Origin-Opener-Policy"=>"same-origin", "Correlation-ID"=>"0c552cc0e52f44b5b184587f3211207a", "Access-Control-Expose-Headers"=>"Correlation-ID", "Via"=>"1.1 devel.croberts.io"}
2024-03-08T13:24:09 [I|bac|] Task {label: Actions::Katello::Repository::VerifyChecksum, id: d89fb91d-fd00-4a9b-a704-2aee121d86b2, execution_plan_id: 74c8c420-c1b6-4bba-8cfe-4d2ea61f8c6e} state changed: stopped  result: success



=> #<ForemanTasks::Task::DynflowTask:0x000055b375ce9c20
 id: "5a3fefd0-3e86-486c-a817-903e84f92133",
 type: "ForemanTasks::Task::DynflowTask",
 label: "Actions::Katello::ContentViewVersion::VerifyChecksum",
 started_at: Fri, 08 Mar 2024 18:24:07.743000000 UTC +00:00,
 ended_at: Fri, 08 Mar 2024 18:24:23.314438000 UTC +00:00,
 state: "stopped",
 result: "success",
 external_id: "06b84611-06a0-4b2e-9b6a-f19098519a77",
 parent_task_id: nil,
 start_at: Fri, 08 Mar 2024 18:24:07.733017000 UTC +00:00,
 start_before: nil,
 action: "Verify checksum of repositories in Module 1.0 content view 'Module'; organization 'Default Organization'",
 user_id: 2,
 state_updated_at: Fri, 08 Mar 2024 18:24:23.325516000 UTC +00:00>

@sjha4
Copy link
Member Author

sjha4 commented Mar 8, 2024

Thanks @chris1984 ! Merging..

@sjha4 sjha4 merged commit a3651e4 into Katello:master Mar 8, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants