diff options
author | Ben Brown <ben.brown@codethink.co.uk> | 2017-10-03 12:55:18 +0000 |
---|---|---|
committer | Ben Brown <ben.brown@codethink.co.uk> | 2017-10-03 12:55:18 +0000 |
commit | 5c63cbdec74f84cbb454d66e038acfac48aacd38 (patch) | |
tree | 811542a70bceabf82d3aedff0e817d790022b09f | |
parent | 4e8c46dc37a1f78c204969d889f16904e20d5399 (diff) | |
parent | 2911542da769991274293f333c42418e3533875a (diff) | |
download | ybd-5c63cbdec74f84cbb454d66e038acfac48aacd38.tar.gz |
Merge branch 'benbrown/kbas-silence' into 'master'
kbas: fixup and silence tar/touch output
See merge request baserock/ybd!391
-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 383a00a..23d251c 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', 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 TypeError('Not a valid tarfile') checksum = cache.md5(artifact) with open(artifact + '.md5', "a") as f: f.write(checksum) |