Fix docker utils
This commit is contained in:
parent
0891cd6746
commit
36eacf67cc
|
@ -7,7 +7,7 @@
|
|||
# For a copy, see <https://opensource.org/licenses/MIT>.
|
||||
|
||||
import tarfile
|
||||
|
||||
import os
|
||||
|
||||
BLUE = '\033[94m'
|
||||
GREEN = '\033[92m'
|
||||
|
@ -78,5 +78,10 @@ def extract_files(container, file_list, out_path):
|
|||
for file in file_list:
|
||||
print('Copying "' + file + '" to ' + out_path)
|
||||
strm, _ = container.get_archive(file)
|
||||
with tarfile.open(fileobj=ReadableStream(strm), mode='r|*') as tar:
|
||||
tar.extractall(out_path)
|
||||
f = open("%s/result.tar.gz" % out_path, "wb")
|
||||
for d in strm:
|
||||
f.write(d)
|
||||
f.close()
|
||||
pw_tar = tarfile.TarFile("%s/result.tar.gz" % out_path)
|
||||
pw_tar.extractall(out_path)
|
||||
os.remove("%s/result.tar.gz" % out_path)
|
||||
|
|
Loading…
Reference in New Issue