diff --git a/jenkins/scripts/zuul_swift_upload.py b/jenkins/scripts/zuul_swift_upload.py index 8a46ac8bbb..58321e04a7 100755 --- a/jenkins/scripts/zuul_swift_upload.py +++ b/jenkins/scripts/zuul_swift_upload.py @@ -23,6 +23,7 @@ import argparse import magic import os import requests +import stat import sys import tempfile import time @@ -40,36 +41,64 @@ import time # in swift, is typically the rel path to the file # list supplied, # 'url': The URL to the log on the log server (absolute, supplied -# by logserver_prefix and swift_destination_prefix) +# by logserver_prefix and swift_destination_prefix), +# 'metadata': { +# 'mime': The filetype/mime, +# 'last_modified': Modification timestamp, +# 'size': The filesize in bytes, +# } # } -def generate_log_index(folder_links): +def generate_log_index(folder_links, header_message=''): """Create an index of logfiles and links to them""" output = '
| Name | Last Modified | Size | ' + output += 'Mime |
|---|---|---|---|
| %s | ' % (file_details['url'], + file_details['filename']) + output += '%s | ' % time.asctime( + file_details['metadata']['last_modified']) + if file_details['metadata']['mime'] == 'folder': + size = str(file_details['metadata']['size']) + else: + size = sizeof_fmt(file_details['metadata']['size']) + output += '%s | ' % size + output += '%s | ' % file_details['metadata']['mime'] + + output += '