Project

Profile

Help

Story #7731

closed

As a user, I can use a /metadata endpoint to efficiently tell me if I need to perform a sync at all

Added by bmbouter about 4 years ago. Updated almost 4 years ago.

Status:
CLOSED - DUPLICATE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

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:

  1. If using the Galaxy V3 API specifically, attempt to fetch /metadata/ early in the sync flow and ignore a 404
  2. If it returns a value compare it to the existing one stored on the AnsibleRepository.
  3. If the value is the same as the one stored do not continue syncing
  4. 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

Is duplicate of Ansible Plugin - Story #7939: As a user, the /v3/ endpoint returns the repository_version.created timeCLOSED - CURRENTRELEASEfao89

Actions

Also available in: Atom PDF