Merge "Do not generate index.html if one exists"

This commit is contained in:
Jenkins 2015-03-16 22:45:18 +00:00 committed by Gerrit Code Review
commit 0ce3db1c63

View File

@ -108,7 +108,12 @@ def generate_log_index(folder_links, header_message=''):
def make_index_file(folder_links, header_message='',
index_filename='index.html'):
"""Writes an index into a file for pushing"""
for file_details in folder_links:
# Do not generate an index file if one exists already.
# This may be the case when uploading other machine generated
# content like python coverage info.
if index_filename == file_details['filename']:
return
index_content = generate_log_index(folder_links, header_message)
tempdir = tempfile.mkdtemp()
fd = open(os.path.join(tempdir, index_filename), 'w')
@ -311,6 +316,7 @@ def build_file_list(file_path, logserver_prefix, swift_destination_prefix,
"Index of %s" % os.path.join(swift_destination_prefix,
relative_path)
)
if full_path:
filename = os.path.basename(full_path)
relative_name = os.path.join(relative_path, filename)
url = os.path.join(destination_prefix, relative_name)
@ -461,6 +467,7 @@ if __name__ == '__main__':
folder_links,
"Index of %s" % swift_destination_prefix
)
if full_path:
filename = os.path.basename(full_path)
relative_name = filename
url = os.path.join(destination_prefix, relative_name)