Bug 705393 - Error on creating repo with schedules.
Summary: Error on creating repo with schedules.
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: z_other
Version: unspecified
Hardware: Unspecified
OS: Unspecified
medium
unspecified
Target Milestone: ---
: Sprint 24
Assignee: Jason Connor
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks: pulp-verified
TreeView+ depends on / blocked
 
Reported: 2011-05-17 15:09 UTC by Preethi Thomas
Modified: 2014-03-31 01:39 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-08-16 14:01:59 UTC
Embargoed:


Attachments (Terms of Use)

Description Preethi Thomas 2011-05-17 15:09:25 UTC
Description of problem:

getting error: operation failed: TypeError: can't compare offset-naive and offset-aware datetimes when trying to create repos with schedules.

But the repo gets created

Version-Release number of selected component (if applicable):
[root@preethi ~]# rpm -q pulp
pulp-0.0.177-1.fc14.noarch


How reproducible:
[root@preethi ~]# pulp-admin repo create --id=pulp-testing-fedora-14-i386 --feed=http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386 --interval P1D --start=2011-05-17T11:30:00-0:6:00
error: operation failed: TypeError: can't compare offset-naive and offset-aware datetimes


[root@preethi ~]# pulp-admin repo create --id=pulp1-testing-fedora-14-i386 --feed=http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386 --interval P1D --start=2011-05-18T00:00:00-0:6:00
error: operation failed: TypeError: can't compare offset-naive and offset-aware datetimes
[root@preethi ~]# pulp-admin repo list
+------------------------------------------+
       List of Available Repositories
+------------------------------------------+



Id                 	pulp-testing-fedora-14-i386
Name               	pulp-testing-fedora-14-i386
Feed URL           	http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386
Feed Type          	remote                   
Feed Certs         	No                       
Consumer Certs     	No                       
Architecture       	noarch                   
Sync Schedule      	2011-05-17T11:30:00/P1D  
Packages           	0                        
Files              	0                        
Distributions      	None                     
Publish            	False                    
Clones             	[]                       
Groups             	None                     
Filters            	[]                       
Notes              	{}                       


Id                 	pulp1-testing-fedora-14-i386
Name               	pulp1-testing-fedora-14-i386
Feed URL           	http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386
Feed Type          	remote                   
Feed Certs         	No                       
Consumer Certs     	No                       
Architecture       	noarch                   
Sync Schedule      	2011-05-18T00:00:00/P1D  
Packages           	0                        
Files              	0                        
Distributions      	None                     
Publish            	False                    
Clones             	[]                       
Groups             	None                     
Filters            	[]                       
Notes              	{}                       





Expected results:


Additional info:

Comment 1 Preethi Thomas 2011-05-18 16:46:53 UTC
From client.log

2011-05-18 12:57:26,745 [ERROR][MainThread] main() @ base.py:216 - error: (500, "TypeError: can't compare offset-naive and offset-aware datetimes", 'Traceback (most recent call last):\n  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/base.py", line 53, in report_error\n    return method(self, *args, **kwargs)\n  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/base.py", line 132, in _auth_decorator\n    value = method(self, *args, **kwargs)\n  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/repositories.py", line 214, in POST\n    notes=repo_data.get(\'notes\', None))\n  File "/usr/lib/python2.7/site-packages/pulp/server/auditing.py", line 199, in _audit\n    result = method(*args, **kwargs)\n  File "/usr/lib/python2.7/site-packages/pulp/server/api/repo.py", line 217, in create\n    update_repo_schedule(r, sync_schedule)\n  File "/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py", line 151, in update_repo_schedule\n    _add_repo_scheduled_sync_task(repo)\n  File "/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py", line 77, in _add_repo_scheduled_sync_task\n    task.scheduler = schedule_to_scheduler(repo[\'sync_schedule\'])\n  File "/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py", line 47, in schedule_to_scheduler\n    return IntervalScheduler(i, s, r)\n  File "/usr/lib/python2.7/site-packages/pulp/server/tasking/scheduler.py", line 121, in __init__\n    start_time < datetime.datetime.now(dateutils.local_tz()) - interval:')



From pulp.log
2011-05-18 12:51:34,020 [ERROR][Dummy-2] report_error() @ base.py:57 - Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/base.py", line 53, in report_error
    return method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/base.py", line 132, in _auth_decorator
    value = method(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/webservices/controllers/repositories.py", line 214, in POST
    notes=repo_data.get('notes', None))
  File "/usr/lib/python2.7/site-packages/pulp/server/auditing.py", line 199, in _audit
    result = method(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/server/api/repo.py", line 217, in create
    update_repo_schedule(r, sync_schedule)
  File "/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py", line 151, in update_repo_schedule
    _add_repo_scheduled_sync_task(repo)
  File "/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py", line 77, in _add_repo_scheduled_sync_task
    task.scheduler = schedule_to_scheduler(repo['sync_schedule'])
  File "/usr/lib/python2.7/site-packages/pulp/server/api/scheduled_sync.py", line 47, in schedule_to_scheduler
    return IntervalScheduler(i, s, r)
  File "/usr/lib/python2.7/site-packages/pulp/server/tasking/scheduler.py", line 121, in __init__
    start_time < datetime.datetime.now(dateutils.local_tz()) - interval:
TypeError: can't compare offset-naive and offset-aware datetimes

Comment 2 Jason Connor 2011-05-19 21:04:04 UTC
added more robust schedule validation and standardization that should guarantee tzinfo being present
fix pushed in 822343f..69813f0

Comment 3 Jeff Ortel 2011-05-20 22:57:01 UTC
build: 0.179

Comment 4 Preethi Thomas 2011-05-23 13:20:43 UTC
Not sure if this is the intended fix. 
[root@preethi ~]# rpm -q pulp
pulp-0.0.179-1.fc14.noarch


Moving back to assigned for confirmation.

I was able to create a repo with schedule with wrong format for start date

[root@preethi ~]# pulp-admin repo create --id=pulp-testing-fedora-14-i386 --feed=http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386 --interval P1D --start=2011-05-23T10:30:00-0:6:00
Successfully created repository [ pulp-testing-fedora-14-i386 ]


[root@preethi ~]# pulp-admin repo list
+------------------------------------------+
       List of Available Repositories
+------------------------------------------+

 Id                 	pulp-testing-fedora-14-i386
Name               	pulp-testing-fedora-14-i386
Feed URL           	http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386
Feed Type          	remote                   
Feed Certs         	CA:No   Cert:No   Key:No
Consumer Certs     	CA:No   Cert:No   Key:No
Architecture       	noarch                   
Sync Schedule      	2011-05-23T10:30:00-04:00/P1D
Packages           	0                        
Files              	0                        
Distributions      	None                     
Publish            	True                     
Clones             	[]                       
Groups             	None                     
Filters            	[]                       
Notes              	{}

Comment 5 Jason Connor 2011-06-08 08:18:47 UTC
yes, that is the intended fix.

Comment 6 Jeff Ortel 2011-06-08 23:58:31 UTC
build: 0.188

Comment 7 Preethi Thomas 2011-07-07 13:51:32 UTC
[root@preethi ~]# rpm -qa pulp
pulp-0.0.202-1.fc14.noarch

[root@preethi ~]# pulp-admin repo create --id=pulp1-testing-fedora-14-i386 --feed=http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386  --interval P1D --start=2011-07-07T00:00:00-0:6:00
Successfully created repository [ pulp1-testing-fedora-14-i386 ]

[root@preethi ~]# pulp-admin repo list
+------------------------------------------+
       List of Available Repositories
+------------------------------------------+

Id                 	pulp1-testing-fedora-14-i386
Name               	pulp1-testing-fedora-14-i386
Feed URL           	http://repos.fedorapeople.org/repos/pulp/pulp/testing/fedora-14/i386
Feed Type          	remote                   
Feed Certs         	CA:No   Cert:No
Consumer Certs     	CA:No   Cert:No
Architecture       	noarch                   
Sync Schedule      	2011-07-07T00:00:00-04:00/P1D
Packages           	0                        
Files              	0                        
Distributions      	None                     
Publish            	True                     
Clones             	[]                       
Groups             	None                     
Filters            	[]                       
Notes              	{}

Comment 8 Preethi Thomas 2011-08-16 14:01:59 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.