Merge branch 'master' of ssh://bitbucket.org/yackob03/quay
This commit is contained in:
commit
00ac3fb639
4 changed files with 34 additions and 10 deletions
|
@ -1,6 +1,8 @@
|
|||
import redis
|
||||
import json
|
||||
|
||||
class BuildStatusRetrievalError(Exception):
|
||||
pass
|
||||
|
||||
class BuildLogs(object):
|
||||
ERROR = 'error'
|
||||
|
@ -45,7 +47,7 @@ class BuildLogs(object):
|
|||
log_entries = self._redis.lrange(self._logs_key(build_id), start_index, -1)
|
||||
return (llen, (json.loads(entry) for entry in log_entries))
|
||||
except redis.ConnectionError:
|
||||
return (0, [])
|
||||
raise BuildStatusRetrievalError('Cannot retrieve build logs')
|
||||
|
||||
@staticmethod
|
||||
def _status_key(build_id):
|
||||
|
@ -65,6 +67,6 @@ class BuildLogs(object):
|
|||
try:
|
||||
fetched = self._redis.get(self._status_key(build_id))
|
||||
except redis.ConnectionError:
|
||||
return None
|
||||
raise BuildStatusRetrievalError('Cannot retrieve build status')
|
||||
|
||||
return json.loads(fetched) if fetched else None
|
||||
|
|
Reference in a new issue