Project

Profile

Help

Story #7942

Updated by fao89 almost 4 years ago

The first stage needs to keep all the existing code and fall back to it if the "new metadata endpoints are not available". They are only available on the Galaxy V3 API *and* if the server side implements them. 

 ## Model Changes 

 Add to the `AnsibleRemote` a new attribute named `last_synced_metadata_time`. Allow it to be None since in many cases, e.g. V2 sync and V3 sync's that don't yet support the new "metadata optimizations" won't be saving data into this attribute. 

 No migration is needed, since a None value will cause a sync to occur, and only subsequent sync's will be no-operation optimized. 

 ## Sync Workflow Changes 

 1. Check at the `/pulp_ansible/galaxy/<path:path>/api/v3/` endpoint and check the build time. If 404, fall back to the existing sync implementation. 
 2. If the build time is the same as the one stored on the Repository object, exit the sync doing nothing (no-operation) 
 3. Fetch all collection data from `/pulp_ansible/galaxy/<path:path>/api/v3/metadata/collections/`. 
 4. Fetch all collection version data from `/pulp_ansible/galaxy/<path:path>/api/v3/metadata/collection_versions/`. 
 5. Build the declarative versions using the data from steps 3 & 4 and sync normally. 
 6. Save the `last_synced_metadata_time` to the `AnsibleRepository` so that the next time sync occurs we can determine if the server side has changed.

Back