Bug 669759 - Package installations can be scheduled for the past
Summary: Package installations can be scheduled for the past
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
low
medium
Target Milestone: ---
: Sprint 21
Assignee: John Matthews
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: verified-to-close 673053
TreeView+ depends on / blocked
 
Reported: 2011-01-14 16:25 UTC by Jay Dobies
Modified: 2011-08-16 12:22 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2011-08-16 12:09:42 UTC
Embargoed:


Attachments (Terms of Use)

Description Jay Dobies 2011-01-14 16:25:50 UTC
We should verify the input to make sure that the package installation scheduled time actually makes sense.

The following example was run on 2011-01-14 using a package install date of a year previous.

$ pulp-admin package install -n emoticons --consumerid client1 --when="2010-01-01 01:01"
Created task id: d525526e-1ffa-11e0-9b23-5254003d10ee
Task is scheduled for: 2010-01-01 01:01
.
Package install failed

Comment 1 John Matthews 2011-03-09 15:31:02 UTC
Below is an example of what happens now if you schedule for a past time.  The change was done client side.  

$ date
Wed Mar  9 10:10:43 EST 2011

$ sudo pulp-admin package install -n zsh --when "2011-03-09 10:00" --consumerid test_consumer
Scheduled time is in the past: 2011-03-09 10:00.  Please re-run with a valid time.


If someone uses the API directly and schedules for a past time, the schedule time is essentially ignored and the the action will be executed as soon as possible. 


Commit:
http://git.fedorahosted.org/git/?p=pulp.git;a=commitdiff;h=cfa4c1e18638617eb1e743143f90454e10cf2b75

Comment 2 Jeff Ortel 2011-03-12 00:17:33 UTC
Build: 0.151

Comment 3 Jeff Ortel 2011-03-12 00:18:05 UTC
Build: 0.151

Comment 4 Preethi Thomas 2011-07-06 17:14:43 UTC
fails_qa
There is a typo in the message 
missing "is" in  "scheduled time in the past"
 
[root@preethi ~]# pulp-admin package install -n zsh --consumerid  pulp-client1 --when="2011-07-05T09:30:00-05:00:00"
error: operation failed: ValueError: AtScheduler: scheduled time in the past: 2011-07-05 14:30:00+00:00

Comment 5 John Matthews 2011-07-06 17:49:12 UTC
http://git.fedorahosted.org/git/?p=pulp.git;a=commitdiff;h=aae12f715c835faff71776d744f48576fa0b93ad

diff --git a/src/pulp/server/tasking/scheduler.py b/src/pulp/server/tasking/scheduler.py
index b458044..bbbb765 100644
--- a/src/pulp/server/tasking/scheduler.py
+++ b/src/pulp/server/tasking/scheduler.py
@@ -82,7 +82,7 @@ class AtScheduler(Scheduler):
         """
         assert isinstance(scheduled_time, datetime.datetime)
         if scheduled_time < datetime.datetime.now(dateutils.local_tz()):
-            raise ValueError('AtScheduler: scheduled time in the past: %s' %
+            raise ValueError('AtScheduler: scheduled time is in the past: %s' %
                              str(scheduled_time))
         self.scheduled_time = dateutils.to_utc_datetime(scheduled_time)


$ sudo pulp-admin package install --consumerid test --when 2010-10-10T12:00 -n zsh
error: operation failed: ValueError: AtScheduler: scheduled time is in the past: 2010-10-10 16:00:00+00:00

Comment 6 Jay Dobies 2011-07-06 19:04:36 UTC
Fixed in 0.202

Comment 7 Preethi Thomas 2011-07-25 19:31:15 UTC
verified

[root@preethi ~]# rpm -q pulp
pulp-0.0.213-1.fc14.noarch
[root@preethi ~]# pulp-admin package install --consumerid=pulp-client -n zsh --when="2011-07-05T09:30:00-05:00:00"
error: operation failed: ValueError: AtScheduler: scheduled time is in the past: 2011-07-05 14:30:00+00:00

Comment 8 Preethi Thomas 2011-08-16 12:09:42 UTC
Closing with Community Release 15

pulp-0.0.223-4.

Comment 9 Preethi Thomas 2011-08-16 12:22:04 UTC
Closing with Community Release 15

pulp-0.0.223-4.


Note You need to log in before you can comment on or make changes to this bug.