Bug 750847

Summary: Getting Next sync time for a repo from the API is not clear
Product: [Retired] Pulp Reporter: James Slagle <jslagle>
Component: user-experienceAssignee: James Slagle <jslagle>
Status: CLOSED CURRENTRELEASE QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.0.0Keywords: Triaged
Target Milestone: ---   
Target Release: Sprint 30   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-24 20:14:40 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description James Slagle 2011-11-02 14:36:42 UTC
In order to get the next sync time for a repository you have to:
1. Get the full task list for the repository
2. Sort the tasks by scheduled time
3. Look at the scheduled time on the earliest executing task and evaluate it based on 4 different possible scenarios to determine when the next sync is.

If the time is in the future, that's the next scheduled sync time.
If it's in the past, and currently running, there's no next sync scheduled yet as one is already running.
If it's in the past and currently waiting, there's no next sync scheduled yet as it's already waiting.
If there is no task with a scheduled time, then the next sync is not scheduled.


We should have 1 simple API call to get the next sync time for a repository.  Implementation details such as what it means for a task to have a scheduled time in the past, but still be waiting should not have to be known by a client in order to use the API.  This is logic that should be server side.

Comment 1 James Slagle 2011-12-20 13:18:00 UTC
I added a next_sync_time field to the following 2 API's:

/repositories/<repoid>/schedules/sync/
/repositories/<repoid>/statuses/sync/

Figured it made sense in both those contexts.  If a repository has no schedule, the field is null.

commit: 02b576031b3f498f2300d21b06fc290437094d31

Comment 2 Jeff Ortel 2012-01-04 21:48:45 UTC
build: 0.256

Comment 3 Preethi Thomas 2012-01-06 19:35:47 UTC
[root@preethi ~]# rpm -q pulp
pulp-0.0.256-1.fc15.noarch

[root@preethi ~]#  curl -k -u admin:admin -X GET https://localhost/pulpsitories/f15/schedules/sync/
{"schedule": "2012-01-07T14:00:00-05:00/PT5M", "id": "f15", "href": "/pulp/api/repositories/f15/", "next_sync_time": "2012-01-07T19:00:00Z", "type": "sync", "options": {"skip": {}}}[root@preethi ~]# 

[root@preethi ~]#  curl -k -u admin:admin -X GET https://localhost/pulp/api/repositories/f15/statuses/sync/
{"exception": null, "traceback": null, "state": "waiting", "next_sync_time": "2012-01-07T19:00:00Z", "progress": null, "repoid": "f15"}[root@preethi ~]#

Comment 4 Preethi Thomas 2012-02-24 20:14:40 UTC
Pulp v1.0 is released
Closed Current Release.

Comment 5 Preethi Thomas 2012-02-24 20:19:34 UTC
Pulp v1.0 is released.