summaryrefslogtreecommitdiffstats
path: root/jjb/scripts
diff options
context:
space:
mode:
authorAndrew Yourtchenko <ayourtch@gmail.com>2021-01-29 11:31:43 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2021-01-29 11:31:43 +0000
commit30ac6e735733993c6a15e173438eb79811cc3b49 (patch)
treeb1778a9f87fecba52dcd5680dcca0f8586459ef0 /jjb/scripts
parent398bb15f2a70c1e2b50dd58fbd6c9e3a32d09978 (diff)
backup upload archives: avoid gzip compressing the files
if they are already compressed Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com> Change-Id: Ie0ce0a303f3d681b8aae697c1b358534e68b2c28
Diffstat (limited to 'jjb/scripts')
-rwxr-xr-xjjb/scripts/backup_upload_archives.sh6
1 files changed, 4 insertions, 2 deletions
diff --git a/jjb/scripts/backup_upload_archives.sh b/jjb/scripts/backup_upload_archives.sh
index a7eb16631..1a9c577e1 100755
--- a/jjb/scripts/backup_upload_archives.sh
+++ b/jjb/scripts/backup_upload_archives.sh
@@ -77,11 +77,13 @@ def upload(storage, bucket, src_fpath, dst_fpath):
:type src_fpath: str
:type dst_fpath: str
"""
- mime = MimeTypes().guess_type(src_fpath)[0]
+ mime_guess = MimeTypes().guess_type(src_fpath)
+ mime = mime_guess[0]
+ encoding = mime_guess[1]
if not mime:
mime = "application/octet-stream"
- if mime in COMPRESS_MIME and bucket in "logs":
+ if mime in COMPRESS_MIME and bucket in "logs" and encoding != "gzip":
compress(src_fpath)
src_fpath = src_fpath + ".gz"
dst_fpath = dst_fpath + ".gz"