diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2017-10-03 12:43:45 +0100 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2017-10-03 12:43:45 +0100 |
commit | 8a68645e24c199061661ff7afa99cad841a27923 (patch) | |
tree | cdae4acb4b2d1f58f5f8975344e2104e1537820b | |
parent | 0c2262220b37f8b3d467429f356437241050d2b2 (diff) | |
download | ybd-8a68645e24c199061661ff7afa99cad841a27923.tar.gz |
Silence tar and touch output
-rwxr-xr-x | kbas/__main__.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/kbas/__main__.py b/kbas/__main__.py index 20ec007..b5bde1e 100755 --- a/kbas/__main__.py +++ b/kbas/__main__.py @@ -93,7 +93,9 @@ class KeyedBinaryArtifactServer(object): @bottle.get('/get/<cache_id>') def get_artifact(cache_id): f = os.path.join(cache_id, cache_id) - call(['touch', os.path.join(app.config['artifact-dir'], f)]) + with open(os.devnull, 'w') as fnull: + call(['touch', os.path.join(app.config['artifact-dir'], f)], + stdout=fnull, stderr=fnull) app.config['downloads'] += 1 return static_file(f, root=app.config['artifact-dir'], download=True, mimetype='application/x-tar') @@ -190,9 +192,12 @@ class KeyedBinaryArtifactServer(object): if ftype != "application/x-rpm": app.log('UPLOAD', 'ERROR: not a valid rpm:', artifact) raise TypeError("Not a valid rpm") - elif call(['tar', 'tf', artifact]): - app.log('UPLOAD', 'ERROR: not a valid tarfile:', artifact) - raise + else: + with open(os.devnull, 'w') as fnull: + if call(['tar', 'tf', artifact], stdout=fnull): + app.log('UPLOAD', 'ERROR: not a valid tarfile:', + artifact) + raise checksum = cache.md5(artifact) with open(artifact + '.md5', "a") as f: f.write(checksum) |