Story #7731
closedAs a user, I can use a /metadata endpoint to efficiently tell me if I need to perform a sync at all
0%
Description
This story includes both the server and client sync implementation.
The idea is to have the repositoryversion's creation time be exposed as a 'created_at' timestamp at a url in the Galaxy V3 API at /metadata/
. That would be listed in the v3 section of urls.py here.
So for a AnsibleDistribution with base_path='my_content'
you would be able to fetch:
GET http://example.com/pulp_ansible/galaxy/my_content/api/v3/metadata/
which would return:
{
"created": 1603308427
}
The value is the unix epoch time. This is taken from the repository verison pulp_created
field which already exists.
Sync usage¶
Add a metadata_created
filed to AnsibleRepository
which can be None.
When syncing an AnsibleRepository:
- If using the Galaxy V3 API specifically, attempt to fetch
/metadata/
early in the sync flow and ignore a 404 - If it returns a value compare it to the existing one stored on the
AnsibleRepository
. - If the value is the same as the one stored do not continue syncing
- If syncing does continue then save the newly fetched value onto
AnsibleRepository.metadata_created
for comparison later.
It should not attempt to fetch this for the V2 API if possible, otherwise ignore it.
Related issues