You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2020/07/11 15:28:56 UTC
[libcloud] 02/03: Also upload shasum files to S3 bucket.
This is an automated email from the ASF dual-hosted git repository.
tomaz pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 2956915b83f7ce21d9341340e9fb3551a0f4491f
Author: Tomaz Muraus <to...@tomaz.me>
AuthorDate: Sat Jul 11 17:28:17 2020 +0200
Also upload shasum files to S3 bucket.
---
contrib/upload-pricing-data-to-s3.py | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/contrib/upload-pricing-data-to-s3.py b/contrib/upload-pricing-data-to-s3.py
index 96a45b3..b6ccbcb 100755
--- a/contrib/upload-pricing-data-to-s3.py
+++ b/contrib/upload-pricing-data-to-s3.py
@@ -46,19 +46,26 @@ def upload_file(file_path):
if not os.path.isfile(file_path):
raise ValueError("File %s doesn't exist" % (file_path))
- print("Uploading pricing data file to S3")
+ print("Uploading pricing data files to S3")
cls = get_driver(Provider.S3)
driver = cls(ACCESS_KEY_ID, ACCESS_KEY_SECRET, region=AWS_REGION)
- file_name = os.path.basename(file_path)
- object_name = file_name
+ file_paths = [
+ file_path,
+ '%s.sha256' % (file_path),
+ '%s.sha512' % (file_path),
+ ]
- container = driver.get_container(container_name=BUCKET_NAME)
- obj = container.upload_object(file_path=file_path, object_name=object_name)
+ for file_path in file_paths:
+ file_name = os.path.basename(file_path)
+ object_name = file_name
- print(("Object uploaded to: %s/%s" % (BUCKET_NAME, object_name)))
- print(obj)
+ container = driver.get_container(container_name=BUCKET_NAME)
+ obj = container.upload_object(file_path=file_path, object_name=object_name)
+
+ print(("Object uploaded to: %s/%s" % (BUCKET_NAME, object_name)))
+ print(obj)
if __name__ == "__main__":