Bug 737180

Summary: Repo update with --interval returns "Improperly formatted schedule" instead of "start time needs to be specified"
Product: [Retired] Pulp Reporter: Sayli Karmarkar <skarmark>
Component: user-experienceAssignee: Jason Connor <jconnor>
Status: CLOSED NOTABUG QA Contact: Preethi Thomas <pthomas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: cperry, mmccune
Target Milestone: ---Keywords: Triaged
Target Release: Sprint 28   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-10-28 20:24:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Sayli Karmarkar 2011-09-09 19:42:21 UTC
Description of problem:

Seems like we do not allow intervals with year and month values without a start time, so when I try updating interval to 'P1M' it errors out with 'Imporperly formatted schedule: P1.0M' which is a bit misleading. 

Log shows: 
2011-09-09 12:27:31,110 [ERROR][MainThread] main() @ command.py:223 - error: (500, "PulpException: 'Imporperly formatted schedule: P1.0M'", 'Traceback (most recent call last):\n  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/decorators.py", line 48, in report_error\n    return method(self, *args, **kwargs)\n  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/decorators.py", line 127, in _auth_decorator\n    value = method(self, *args, **kwargs)\n  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/repositories.py", line 330, in PUT\n    repo = api.update(id, delta)\n  File "/home/skarmark/git/pulp/src/pulp/server/api/repo.py", line 674, in update\n    update_repo_schedule(repo, value)\n  File "/home/skarmark/git/pulp/src/pulp/server/api/scheduled_sync.py", line 173, in update_repo_schedule\n    repo[\'sync_schedule\'] = validate_schedule(new_schedule)\n  File "/home/skarmark/git/pulp/src/pulp/server/api/scheduled_sync.py", line 52, in validate_schedule\n    interval, start, runs = dateutils.parse_iso8601_interval(schedule)\n  File "/home/skarmark/git/pulp/src/pulp/common/dateutils.py", line 219, in parse_iso8601_interval\n    raise isodate.ISO8601Error(\'Intervals with year and month values are not valid without a start time\')')
2011-09-09 12:27:54,717 [ERROR][MainThread] main() @ command.py:223 - error: (500, "PulpException: 'Imporperly formatted schedule: P1.0M'", 'Traceback (most recent call last):\n  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/decorators.py", line 48, in report_error\n    return method(self, *args, **kwargs)\n  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/decorators.py", line 127, in _auth_decorator\n    value = method(self, *args, **kwargs)\n  File "/home/skarmark/git/pulp/src/pulp/server/webservices/controllers/repositories.py", line 330, in PUT\n    repo = api.update(id, delta)\n  File "/home/skarmark/git/pulp/src/pulp/server/api/repo.py", line 674, in update\n    update_repo_schedule(repo, value)\n  File "/home/skarmark/git/pulp/src/pulp/server/api/scheduled_sync.py", line 173, in update_repo_schedule\n    repo[\'sync_schedule\'] = validate_schedule(new_schedule)\n  File "/home/skarmark/git/pulp/src/pulp/server/api/scheduled_sync.py", line 52, in validate_schedule\n    interval, start, runs = dateutils.parse_iso8601_interval(schedule)\n  File "/home/skarmark/git/pulp/src/pulp/common/dateutils.py", line 219, in parse_iso8601_interval\n    raise isodate.ISO8601Error(\'Intervals with year and month values are not valid without a start time\')')


We should show this error in cli as well as it will be hard for user to figure out what is wrong with the interval as it is right according to iso8601. 


How reproducible:

$ sudo pulp-admin repo update --id=pulp --interval P1M
error: operation failed: PulpException: 'Imporperly formatted schedule: P1.0M'


Expected results:

$ sudo pulp-admin repo update --id=pulp --interval P1M
error: operation failed: PulpException: 'Intervals with year and month values are not valid without a start time'

Comment 1 Jeff Ortel 2011-10-13 00:49:17 UTC
build: 0.238

Comment 2 Preethi Thomas 2011-10-20 18:33:22 UTC
fails_qa

[root@preethi ~]# rpm -q pulp
pulp-0.0.240-1.fc15.noarch
[root@preethi ~]# 
[root@preethi ~]# 
[root@preethi ~]# pulp-admin repo update --id=f14 --interval P1M
error: operation failed: PulpException: Improperly formatted schedule: P1.0M
[root@preethi ~]#

Comment 3 Jason Connor 2011-10-28 20:24:15 UTC
pulp-admin repo update no longer sets the sync schedule, closing as not a bug as there's no such thing as "no longer a bug"