"""Library of functions for deploying artifacts to Nexus."""
import concurrent.futures
+import datetime
import errno
import glob
import gzip
log.debug("Files found: {}".format(paths))
no_dups_paths = _remove_duplicates_and_sort(paths)
-
for src in no_dups_paths:
if len(os.path.basename(src)) > 255:
log.warn("Filename {} is over 255 characters. Skipping...".format(os.path.basename(src)))
else:
log.info("Not copying directories: {}.".format(src))
+ # Create a temp file to handle empty dirs in AWS S3 buckets.
+ if os.environ.get("S3_BUCKET") is not None:
+ now = datetime.datetime.now()
+ p = now.strftime("_%d%m%Y_%H%M%S_")
+ for dirpath, dirnames, files in os.walk(dest_dir):
+ if not files:
+ fd, tmp = tempfile.mkstemp(prefix=p, dir=dirpath)
+ os.close(fd)
+ log.debug("temp file created in dir: {}.".format(dirpath))
+
def deploy_archives(nexus_url, nexus_path, workspace, pattern=None):
"""Archive files to a Nexus site repository named logs.
--- /dev/null
+---
+fixes:
+ - |
+ Create an temp file for logs shipping with AWS S3 Buckets.
+
+ Since S3 buckets does not have an underlying file system, to view empty
+ directories, an temp file has to be created when referencing the directory.
+ This allows empty folders to be viewed through cloudfront, without which
+ a 404 error is returned.