From 113b8691694c33a09a2a2ea6eb2b0df823029b7b Mon Sep 17 00:00:00 2001
From: baloola <baloola-mu@hotmail.com>
Date: Mon, 2 Nov 2020 16:40:56 +0100
Subject: [PATCH] check swift auth

---
 testing/gitlab_test.sh       |  1 -
 testing/preprocessor_test.py | 18 ++++++++++++------
 testing/preprocessor_test.sh |  3 +++
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/testing/gitlab_test.sh b/testing/gitlab_test.sh
index 6df82086..8ce6b51f 100755
--- a/testing/gitlab_test.sh
+++ b/testing/gitlab_test.sh
@@ -40,7 +40,6 @@ docker stack deploy -c ../docker-compose.emg.yml -c ../docker-compose.emg.dev.ym
 
 # installing the requirments
 apk update && apk add bash postgresql-dev gcc g++ python3 python3-dev musl-dev py-pip libffi-dev openssl-dev make gdal==3.1.4-r0 gdal-dev==3.1.4-r0
-gdalinfo --version
 pip3 install -r requirements.txt
 
 ./docker-stack-wait.sh -n renderer -n registrar -n preprocessor -n ingestor -n sftp emg-pvs
diff --git a/testing/preprocessor_test.py b/testing/preprocessor_test.py
index b9d66b16..289e4ae5 100644
--- a/testing/preprocessor_test.py
+++ b/testing/preprocessor_test.py
@@ -1,17 +1,23 @@
 import os
 import sys
-
+import re
 
 from osgeo import gdal
 
 
+
+
+
 def set_gdal_swift_auth():
+    with open('preprocessor_test.txt','r') as auth_values:
+        values_list = []
+        for aline in auth_values:
+
+            x = re.search("(?:=)(.*)", aline)
+            values_list.append(x.group(1))
 
-    storage_url=os.environ['SWIFT_STORAGE_URL']
-    auth_token=os.environ['SWIFT_AUTH_TOKEN']
-    # setting gdal config
-    gdal.SetConfigOption("SWIFT_STORAGE_URL", storage_url)
-    gdal.SetConfigOption("SWIFT_AUTH_TOKEN", auth_token)
+    gdal.SetConfigOption("SWIFT_STORAGE_URL", values_list[0])
+    gdal.SetConfigOption("SWIFT_AUTH_TOKEN", values_list[1])
 
 
 
diff --git a/testing/preprocessor_test.sh b/testing/preprocessor_test.sh
index 051e3876..cd8ae26d 100755
--- a/testing/preprocessor_test.sh
+++ b/testing/preprocessor_test.sh
@@ -19,13 +19,16 @@ IFS="="
 while read  key value ; do
 
     if [ "$key" = "export OS_STORAGE_URL" ]; then
+
         export SWIFT_STORAGE_URL=$value
     else 
         export SWIFT_AUTH_TOKEN=$value
     fi
 done < preprocessor_test.txt
 
+cat preprocessor_test.txt
 
+printenv
 while read product; do
     echo $product
     # preprocessing the images and save the results in the result bucket
-- 
GitLab