summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Henkel <tobias.henkel@bmw.de>2018-08-02 08:42:24 +0200
committerTobias Henkel <tobias.henkel@bmw.de>2018-11-19 21:17:19 +0100
commitd6cc971de571078708c4e58938d2add850cf7b8f (patch)
tree42db178b8c03ee4cd6ff7171f5453d9333aa55bf
parent125eeed6fe76b79d9ca63e720941137f539659fa (diff)
Remove mimetype check when calculating size
We currently try to skip size formatting for folders. However we compare with a bogix mimetype so the check is false in every case. Further folders typically have a size of 512 bytes or 4k. In both cases we don't really need to skip the size formatting so instead of fixing the check just skip it and do the size formatting unconditionally. Change-Id: I7ef021381bb56acf4b22551cc5d5613470fd6d08
Notes
Notes (review): Code-Review+2: Andreas Jaeger <jaegerandi@gmail.com> Code-Review+2: James E. Blair <corvus@inaugust.com> Code-Review+2: Clark Boylan <cboylan@sapwetik.org> Workflow+1: Clark Boylan <cboylan@sapwetik.org> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 19 Nov 2018 21:29:49 +0000 Reviewed-on: https://review.openstack.org/588150 Project: openstack-infra/zuul-jobs Branch: refs/heads/master
-rwxr-xr-xroles/upload-logs-swift/library/zuul_swift_upload.py5
1 files changed, 1 insertions, 4 deletions
diff --git a/roles/upload-logs-swift/library/zuul_swift_upload.py b/roles/upload-logs-swift/library/zuul_swift_upload.py
index 00522e9..e2aa46c 100755
--- a/roles/upload-logs-swift/library/zuul_swift_upload.py
+++ b/roles/upload-logs-swift/library/zuul_swift_upload.py
@@ -362,10 +362,7 @@ class Indexer():
362 filename) 362 filename)
363 output += '<td>%s</td>' % time.asctime( 363 output += '<td>%s</td>' % time.asctime(
364 file_details.last_modified) 364 file_details.last_modified)
365 if file_details.mimetype == 'folder': 365 size = sizeof_fmt(file_details.size, suffix='')
366 size = str(file_details.size)
367 else:
368 size = sizeof_fmt(file_details.size, suffix='')
369 output += '<td style="text-align: right">%s</td>' % size 366 output += '<td style="text-align: right">%s</td>' % size
370 output += '</tr>\n' 367 output += '</tr>\n'
371 368