mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 00:55:19 +00:00
Compress thin.zip if zlib is available
This commit is contained in:
parent
56bc7a58d9
commit
b917138a93
@ -23,6 +23,11 @@ import msgpack
|
||||
import salt.ext.six as _six
|
||||
import tornado
|
||||
|
||||
try:
|
||||
import zlib
|
||||
except ImportError:
|
||||
zlib = None
|
||||
|
||||
# pylint: disable=import-error,no-name-in-module
|
||||
try:
|
||||
import certifi
|
||||
@ -392,7 +397,7 @@ def gen_thin(cachedir, extra_mods='', overwrite=False, so_mods='',
|
||||
if compress == 'gzip':
|
||||
tfp = tarfile.open(thintar, 'w:gz', dereference=True)
|
||||
elif compress == 'zip':
|
||||
tfp = zipfile.ZipFile(thintar, 'w')
|
||||
tfp = zipfile.ZipFile(thintar, 'w', compression=zlib and zipfile.ZIP_DEFLATED or zipfile.ZIP_STORED)
|
||||
tfp.add = tfp.write
|
||||
|
||||
try: # cwd may not exist if it was removed but salt was run from it
|
||||
|
Loading…
Reference in New Issue
Block a user