FIX: Added some additional error codes for pull-list retrieval, FIX: Fixed cache-cleanup not indicating how many items were successsfully cleaned

This commit is contained in:
evilhero 2019-02-05 13:14:02 -05:00
parent e891aa5e27
commit 6c487d5c54
3 changed files with 78 additions and 68 deletions

View File

@ -809,7 +809,7 @@ class Config(object):
cntr+=1
if cntr > 1:
logger.fdebug('[Cache Cleanup] Cache Cleanup finished. Cleaned %s items')
logger.fdebug('[Cache Cleanup] Cache Cleanup finished. Cleaned %s items' % cntr)
else:
logger.fdebug('[Cache Cleanup] Cache Cleanup finished. Nothing to clean!')

View File

@ -58,13 +58,13 @@ def locg(pulldate=None,weeknumber=None,year=None):
logger.warn(e)
return {'status': 'failure'}
if r.status_code == '619':
if str(r.status_code) == '619':
logger.warn('[' + str(r.status_code) + '] No date supplied, or an invalid date was provided [' + str(pulldate) + ']')
return {'status': 'failure'}
elif r.status_code == '999' or r.status_code == '111':
elif str(r.status_code) == '999' or str(r.status_code) == '111':
logger.warn('[' + str(r.status_code) + '] Unable to retrieve data from site - this is a site.specific issue [' + str(pulldate) + ']')
return {'status': 'failure'}
elif str(r.status_code) == '200':
data = r.json()
logger.info('[WEEKLY-PULL] There are ' + str(len(data)) + ' issues for the week of ' + str(weeknumber) + ', ' + str(year))
@ -137,3 +137,11 @@ def locg(pulldate=None,weeknumber=None,year=None):
'weeknumber': weeknumber,
'year': year}
else:
if str(r.status_code) == '666':
logger.warn('[%s] The error returned is: %s' % (r.status_code, r.headers))
return {'status': 'update_required'}
else:
logger.warn('[%s] The error returned is: %s' % (r.status_code, r.headers))
return {'status': 'failure'}

View File

@ -81,7 +81,9 @@ def pullit(forcecheck=None, weeknumber=None, year=None):
elif chk_locg['status'] == 'success':
logger.info('[PULL-LIST] Weekly Pull List successfully loaded with ' + str(chk_locg['count']) + ' issues.')
return new_pullcheck(chk_locg['weeknumber'],chk_locg['year'])
elif chk_log['status'] == 'update_required':
logger.warn('[PULL-LIST] Your version of Mylar is not up-to-date. You MUST update before this works')
return
else:
logger.info('[PULL-LIST] Unable to retrieve weekly pull-list. Dropping down to legacy method of PW-file')
mylar.PULLBYFILE = pull_the_file(newrl)