From 9477585a35d3a8e3d016bb94cb08551b718965ff Mon Sep 17 00:00:00 2001 From: said-moj <45761276+said-moj@users.noreply.github.com> Date: Tue, 8 Aug 2023 13:46:42 +0100 Subject: [PATCH] Adding steps to install ibcurl4-gnutls-dev because it is required for pycurl to the pipeline --- .circleci/config.yml | 6 ++++++ cla_backend/libs/aws/s3.py | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 46c3312f1..4ff7f4156 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -97,6 +97,9 @@ jobs: - run: name: Setup Python environment command: | + echo "Installing ibcurl4-gnutls-dev because it is required for pycurl" + sudo apt-get update + sudo apt-get install -y libcurl4-gnutls-dev pip install virtualenv virtualenv pip-compile-env - restore_cache: @@ -137,6 +140,9 @@ jobs: - run: name: Setup Python environment command: | + echo "Installing ibcurl4-gnutls-dev because it is required for pycurl" + sudo apt-get update + sudo apt-get install -y libcurl4-gnutls-dev sudo apt-get update && sudo apt-get install -y libpython2.7 firefox pip install virtualenv virtualenv env diff --git a/cla_backend/libs/aws/s3.py b/cla_backend/libs/aws/s3.py index 1f3a4c54e..095e0a281 100644 --- a/cla_backend/libs/aws/s3.py +++ b/cla_backend/libs/aws/s3.py @@ -19,16 +19,17 @@ def get_s3_connection(cls, bucket_name): @classmethod def download_file(cls, bucket_name, key): try: - obj = cls.get_s3_connection(bucket_name).bucket.Object(key.strip("/")) + obj = cls.get_s3_connection(bucket_name).bucket.Object(key) data = NamedTemporaryFile() obj.download_fileobj(data) + data.seek(0) return {"headers": {"Content-Type": obj.content_type}, "body": data} except ClientError: return None @classmethod def save_file(cls, bucket_name, key, path): - cls.get_s3_connection(bucket_name).save(key, open(path, "rb")) + cls.get_s3_connection(bucket_name).bucket.Object(key).upload_file(path) @classmethod def delete_file(cls, bucket_name, key):