From 9cf0e7ccf7d5273962f9775b491856a01c337776 Mon Sep 17 00:00:00 2001
From: Mussab Abdalla <mussab.abdalla@eox.at>
Date: Tue, 17 Mar 2020 18:08:46 +0100
Subject: [PATCH] capitalize collection env & optional bucket

---
 preprocessor/preprocessor.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/preprocessor/preprocessor.py b/preprocessor/preprocessor.py
index 9894bbad..e24892eb 100644
--- a/preprocessor/preprocessor.py
+++ b/preprocessor/preprocessor.py
@@ -349,6 +349,12 @@ if __name__ == "__main__":
             "Path to object holding tar archive file of product."
         )
     )
+    parser.add_argument(
+        "--upload-container", default=None,
+        help=(
+            "The name of the swift container where the result is uploaded."
+        )
+    )
     parser.add_argument(
         "--replace", action="store_true",
         help=(
@@ -380,15 +386,17 @@ if __name__ == "__main__":
 
     setup_logging(arg_values.verbosity)
 
-    collection = os.environ.get('Collection')
+    collection = os.environ.get('COLLECTION')
     if collection is None:
         logger.critical("Collection environment variable not set.")
         sys.exit(1)
 
-    upload_container = os.environ.get('UPLOAD_CONTAINER')
+    upload_container = arg_values.upload_container
     if upload_container is None:
-        logger.critical("UPLOAD_CONTAINER environment variable not set.")
-        sys.exit(1)
+        upload_container = os.environ.get('UPLOAD_CONTAINER')
+        if upload_container is None:
+            logger.critical("UPLOAD_CONTAINER environment variable not set.")
+            sys.exit(1)
 
     if arg_values.mode == "standard":
         preprocessor(
-- 
GitLab