Make log error punctuation consistent.

This commit is contained in:
rallytime 2014-07-09 09:55:01 -06:00
parent 7942350a65
commit 49fa71e088

View File

@ -224,9 +224,9 @@ class Schedule(object):
# we dont do any checking here besides making sure its a dict. # we dont do any checking here besides making sure its a dict.
# eval() already does for us and raises errors accordingly # eval() already does for us and raises errors accordingly
if not type(data) is dict: if not type(data) is dict:
raise ValueError('Scheduled jobs have to be of type dict') raise ValueError('Scheduled jobs have to be of type dict.')
if not len(data.keys()) == 1: if not len(data.keys()) == 1:
raise ValueError('You can only schedule one new job at a time') raise ValueError('You can only schedule one new job at a time.')
new_job = data.keys()[0] new_job = data.keys()[0]
@ -430,7 +430,7 @@ class Schedule(object):
self.returners[ret_str](ret) self.returners[ret_str](ret)
else: else:
log.info( log.info(
'Job {0} using invalid returner: {1} Ignoring.'.format( 'Job {0} using invalid returner: {1}. Ignoring.'.format(
func, returner func, returner
) )
) )
@ -499,11 +499,11 @@ class Schedule(object):
if time_conflict: if time_conflict:
log.error('Unable to use "seconds", "minutes", "hours", or "days" with ' log.error('Unable to use "seconds", "minutes", "hours", or "days" with '
'"when" or "cron" options. Ignoring.') '"when" or "cron" options. Ignoring.')
continue continue
if 'when' in data and 'cron' in data: if 'when' in data and 'cron' in data:
log.error('Unable to use "when" and "cron" options together. Ignoring.') log.error('Unable to use "when" and "cron" options together. Ignoring.')
continue continue
time_elements = ['seconds', 'minutes', 'hours', 'days'] time_elements = ['seconds', 'minutes', 'hours', 'days']
@ -515,7 +515,7 @@ class Schedule(object):
seconds += int(data.get('days', 0)) * 86400 seconds += int(data.get('days', 0)) * 86400
elif 'when' in data: elif 'when' in data:
if not _WHEN_SUPPORTED: if not _WHEN_SUPPORTED:
log.error('Missing python-dateutil. Ignoring job {0}'.format(job)) log.error('Missing python-dateutil. Ignoring job {0}'.format(job))
continue continue
if isinstance(data['when'], list): if isinstance(data['when'], list):
@ -525,7 +525,7 @@ class Schedule(object):
try: try:
tmp = int(dateutil_parser.parse(i).strftime('%s')) tmp = int(dateutil_parser.parse(i).strftime('%s'))
except ValueError: except ValueError:
log.error('Invalid date string {0}. Ignoring job {1}.'.format(i, job)) log.error('Invalid date string {0}. Ignoring job {1}.'.format(i, job))
continue continue
if tmp >= now: if tmp >= now:
_when.append(tmp) _when.append(tmp)
@ -565,7 +565,7 @@ class Schedule(object):
try: try:
when = int(dateutil_parser.parse(data['when']).strftime('%s')) when = int(dateutil_parser.parse(data['when']).strftime('%s'))
except ValueError: except ValueError:
log.error('Invalid date string. Ignoring') log.error('Invalid date string. Ignoring')
continue continue
now = int(time.time()) now = int(time.time())
@ -596,7 +596,7 @@ class Schedule(object):
try: try:
cron = int(croniter.croniter(data['cron'], now).get_next()) cron = int(croniter.croniter(data['cron'], now).get_next())
except (ValueError, KeyError): except (ValueError, KeyError):
log.error('Invalid cron string. Ignoring') log.error('Invalid cron string. Ignoring')
continue continue
seconds = cron - now seconds = cron - now
else: else:
@ -626,9 +626,9 @@ class Schedule(object):
else: else:
if 'splay' in data: if 'splay' in data:
if 'when' in data: if 'when' in data:
log.error('Unable to use "splay" with "when" option at this time. Ignoring.') log.error('Unable to use "splay" with "when" option at this time. Ignoring.')
elif 'cron' in data: elif 'cron' in data:
log.error('Unable to use "splay" with "cron" option at this time. Ignoring.') log.error('Unable to use "splay" with "cron" option at this time. Ignoring.')
else: else:
data['_seconds'] = data['seconds'] data['_seconds'] = data['seconds']
@ -646,19 +646,19 @@ class Schedule(object):
if run: if run:
if 'range' in data: if 'range' in data:
if not _RANGE_SUPPORTED: if not _RANGE_SUPPORTED:
log.error('Missing python-dateutil. Ignoring job {0}'.format(job)) log.error('Missing python-dateutil. Ignoring job {0}'.format(job))
continue continue
else: else:
if isinstance(data['range'], dict): if isinstance(data['range'], dict):
try: try:
start = int(dateutil_parser.parse(data['range']['start']).strftime('%s')) start = int(dateutil_parser.parse(data['range']['start']).strftime('%s'))
except ValueError: except ValueError:
log.error('Invalid date string for start. Ignoring job {0}.'.format(job)) log.error('Invalid date string for start. Ignoring job {0}.'.format(job))
continue continue
try: try:
end = int(dateutil_parser.parse(data['range']['end']).strftime('%s')) end = int(dateutil_parser.parse(data['range']['end']).strftime('%s'))
except ValueError: except ValueError:
log.error('Invalid date string for end. Ignoring job {0}.'.format(job)) log.error('Invalid date string for end. Ignoring job {0}.'.format(job))
continue continue
if end > start: if end > start:
if 'invert' in data['range'] and data['range']['invert']: if 'invert' in data['range'] and data['range']['invert']:
@ -685,7 +685,7 @@ class Schedule(object):
else: else:
if 'splay' in data: if 'splay' in data:
if 'when' in data: if 'when' in data:
log.error('Unable to use "splay" with "when" option at this time. Ignoring.') log.error('Unable to use "splay" with "when" option at this time. Ignoring.')
else: else:
if isinstance(data['splay'], dict): if isinstance(data['splay'], dict):
if data['splay']['end'] > data['splay']['start']: if data['splay']['end'] > data['splay']['start']: