attempt to fix tar extract and http reqs

This commit is contained in:
Louis Abel 2023-05-11 18:16:59 -07:00
parent 28ba75d019
commit 82c7b60ef2
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36

View File

@ -637,15 +637,27 @@ class Shared:
logger.error('There was an issue downloading from %s' % s3_bucket) logger.error('There was an issue downloading from %s' % s3_bucket)
@staticmethod @staticmethod
def reqs_determine_latest(s3_bucket_url, release, arches, filetype, name, logger): def reqs_determine_latest(s3_bucket_url, release, arches, filetype, name, logger, page_size=1000):
""" """
Using requests, determine the latest artifacts and return a list Using requests, determine the latest artifacts and return a list
""" """
temp = [] temp = []
data = {} data = {}
marker = None
while True:
params = {}
if marker is not None:
params['marker'] = marker
params['delimiter'] = '/'
params['max-keys'] = str(page_size)
try: try:
bucket_data = requests.get(s3_bucket_url) bucket_data = requests.get(
s3_bucket_url,
params=params,
timeout=100
)
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e:
logger.error('The s3 bucket http endpoint is inaccessible') logger.error('The s3 bucket http endpoint is inaccessible')
raise SystemExit(e) raise SystemExit(e)
@ -1143,7 +1155,7 @@ class Shared:
if not Shared.tar_is_within_directory(path, member_path): if not Shared.tar_is_within_directory(path, member_path):
raise Exception("Path traversal attempted in tar file") raise Exception("Path traversal attempted in tar file")
tar.extractall(path, members, numeric_owner) tar.extractall(path=path, members=members, numeric_owner=numeric_owner)
@staticmethod @staticmethod
def dnf_sync(repo, sync_root, work_root, arch, logger): def dnf_sync(repo, sync_root, work_root, arch, logger):