summaryrefslogtreecommitdiff
path: root/kbas
diff options
context:
space:
mode:
authorDaniel Firth <dan.firth@codethink.co.uk>2016-11-03 14:06:44 +0000
committerDaniel Firth <dan.firth@codethink.co.uk>2016-11-16 19:31:36 +0000
commitc3d414dd1fd062dafe0806851094a953530a7fdd (patch)
tree5e991fdcf62908f9a47a0d17a2d27cc905bac6c4 /kbas
parentad53dd542e43b8f4c6c55fad8452a0962f842834 (diff)
downloadybd-c3d414dd1fd062dafe0806851094a953530a7fdd.tar.gz
Move chdir, timer to utils; fix circular deps
Diffstat (limited to 'kbas')
-rwxr-xr-xkbas/__main__.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/kbas/__main__.py b/kbas/__main__.py
index 204c7b9..3eecd89 100755
--- a/kbas/__main__.py
+++ b/kbas/__main__.py
@@ -86,14 +86,15 @@ class KeyedBinaryArtifactServer(object):
@bottle.get('/1.0/artifacts')
def get_morph_artifact():
f = request.query.filename
- return static_file(f, root=config.config['artifact-dir'], download=True)
+ return static_file(f, root=config.config['artifact-dir'],
+ download=True)
@bottle.get('/get/<cache_id>')
def get_artifact(cache_id):
f = os.path.join(cache_id, cache_id)
config.config['downloads'] += 1
- return static_file(f, root=config.config['artifact-dir'], download=True,
- mimetype='application/x-tar')
+ return static_file(f, root=config.config['artifact-dir'],
+ download=True, mimetype='application/x-tar')
@bottle.get('/')
@bottle.get('/status')
@@ -103,7 +104,8 @@ class KeyedBinaryArtifactServer(object):
artifacts = len(os.listdir(config.config['artifact-dir']))
started = config.config['start-time'].strftime('%y-%m-%d %H:%M:%S')
downloads = config.config['downloads']
- last_upload = config.config['last-upload'].strftime('%y-%m-%d %H:%M:%S')
+ last_upload = config.config['last-upload'].strftime(
+ '%y-%m-%d %H:%M:%S')
content = [['Started:', started, None]]
content += [['Last upload:', last_upload, None]]
if config.config.get('last-reject'):
@@ -131,7 +133,8 @@ class KeyedBinaryArtifactServer(object):
response.status = 400 # bad request, cache_id contains bad things
return
- if os.path.isdir(os.path.join(config.config['artifact-dir'], cache_id)):
+ if os.path.isdir(os.path.join(config.config['artifact-dir'],
+ cache_id)):
if cache.check(cache_id) == request.forms.get('checksum', 'XYZ'):
response.status = 777 # this is the same binary we have
return