Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions roles/install-tools/files/githubdownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,13 @@ def extract_tar(compressed_data, out_file):
Returns: Nothing
"""
try:
gzip_header = compressed_data.getvalue()[:10]
if gzip_header.startswith(b"\x1f\x8b"):
with gzip.open(compressed_data, "rb") as gz:
with tarfile.open(fileobj=gz, mode="r:gz") as tar:
tar.extractall(path=out_file)
return
else:
raise Exception("Unable to identify compression type")
gzip_header = compressed_data.getvalue()[:10]
if gzip_header.startswith(b"\x1f\x8b"):
tar = tarfile.open(fileobj=compressed_data)
tar.extractall(path=out_file)
return
else:
raise Exception("Unable to identify compression type")
except Exception as e:
raise Exception(e)

Expand Down