Story #5613
Updated by bmbouter over 4 years ago
## Motivation Users can experience corrupted files either due to bit rot on mechanical hard drives or mistakenly run commands. We should make it as easy as possible to correct this situation when we can. ## Idea Make a new API endpoint that lives at `/pulp/api/v3/repair/` and has 1 required parameter `repository` which is the href to the repository that is being requested to be repaired. Initially every request will be for a single repository. ## Details 1\. examines all downloaded content in the latest version and checks to see if each unit matches its expected checksum 2\. re-downloads any corrupted files if possible based on RemoteArtifact entries in db 3\. reports any units that could not be re-downloaded as counts ## API Response ``` { "pulp_created": "2019-07-23T08:18:12.927007Z", "pulp_href": "/pulp/api/v3/task-groups/59f8a786-c7d7-4e2b-ad07-701479d403c5/", "repository_version_href": "/pulp/api/v3/repository/<path to the repository version/", "checked": 7264, "repaired": [ "/pulp/api/v3/content/file/files/c23def43-44bc-45f4-8a6f-0310285f5339/", "/pulp/api/v3/content/file/files/18swef43-98s1-8d71-s8u1-0310285ffiq/" ], 3, "unrepairable": [ "/pulp/api/v3/content/file/files/c23def43-44bc-45f4-8a6f-0310285f5339/" ], 0, } ``` The checked count is expected to equal the count of total items in the repository version. ## Note This is only going to fix bitrot/corrupted files. It only inspects the content contained in the latest repository version, and does not consider if that repository version is an accurate or complete representation of the remote filesystem.