Merge pull request #31 from chrismeyersfsu/improvement-cleanup_jobs_error_handling

added graceful fail and meaningful error message when --days specified is too large
This commit is contained in:
Matthew Jones 2015-01-21 09:53:53 -05:00
commit bb5f3243e3

View File

@ -129,7 +129,10 @@ class Command(NoArgsCommand):
self.init_logging()
self.days = int(options.get('days', 90))
self.dry_run = bool(options.get('dry_run', False))
self.cutoff = now() - datetime.timedelta(days=self.days)
try:
self.cutoff = now() - datetime.timedelta(days=self.days)
except OverflowError as e:
raise CommandError('--days specified is too large. Try something less than 99999 (about 270 years).')
self.only_jobs = bool(options.get('only_jobs', False))
self.only_project_updates = bool(options.get('only_project_updates', False))
self.only_inventory_updates = bool(options.get('only_inventory_updates', False))