libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject [libcloud] 02/03: Also upload shasum files to S3 bucket.
Date Sat, 11 Jul 2020 15:28:56 GMT
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 <tomaz@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__":


Mime
View raw message