You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sdap.apache.org by nc...@apache.org on 2021/04/16 23:34:57 UTC

[incubator-sdap-nexus] branch master updated: SDAP-304 : Added optional domsconfig "create_keyspace_granted" (#125)

This is an automated email from the ASF dual-hosted git repository.

nchung pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-sdap-nexus.git


The following commit(s) were added to refs/heads/master by this push:
     new 4271bea  SDAP-304 : Added optional domsconfig "create_keyspace_granted"  (#125)
4271bea is described below

commit 4271beac89341c60a49daa540219c56d9302455a
Author: Antoine QUÉRIC <an...@gmail.com>
AuthorDate: Sat Apr 17 01:34:49 2021 +0200

    SDAP-304 : Added optional domsconfig "create_keyspace_granted"  (#125)
    
    * SDAP-304 : Added optional domsconfig "create_keyspace_granted" (True [default] / False) to check before creating keyspace (in case of user permissions being not sufficient for such operation)
    
    * SDAP-305: Get current match up working with AVHRR OI data that is currently ingested in the bigdata cluster (#124)
    
    * SDAP-305: Updated webapp dockerfile to work with Python 3 and new version of pyspark
    
    * SDAP-305: Pass kubernetes config into doms/matchup endpoints and overwrite domsconfig.ini
    
    * SDAP-305: Fixes for /domsplot endpoint
    
    * SDAP-305: Updated /domssubset /datainbounds and /domsinsitusubset to a runnable state
    
    * SDAP-305: Pass k8s config to /domsplot endpoint so config file is overwritten
    
    * SDAP-304 : fixed the NoOptionError exception which lacked the module named
    
    * SDAP-304 : Added optional domsconfig "create_keyspace_granted" (True [default] / False) to check before creating keyspace (in case of user permissions being not sufficient for such operation)
    
    * SDAP-304 : fixed the NoOptionError exception which lacked the module named
    
    Co-authored-by: QUERIC <an...@ifremer.fr>
    Co-authored-by: Stepheny Perez <sk...@users.noreply.github.com>
---
 analysis/webservice/algorithms/doms/DomsInitialization.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/analysis/webservice/algorithms/doms/DomsInitialization.py b/analysis/webservice/algorithms/doms/DomsInitialization.py
index 097b4a8..a2cf4b1 100644
--- a/analysis/webservice/algorithms/doms/DomsInitialization.py
+++ b/analysis/webservice/algorithms/doms/DomsInitialization.py
@@ -47,6 +47,10 @@ class DomsInitializer:
         cassDatacenter = domsconfig.get("cassandra", "local_datacenter")
         cassVersion = int(domsconfig.get("cassandra", "protocol_version"))
         cassPolicy = domsconfig.get("cassandra", "dc_policy")
+        try:
+            cassCreateKeyspaceGranted = domsconfig.get("cassandra", "create_keyspace_granted")
+        except configparser.NoOptionError:
+            cassCreateKeyspaceGranted = "True"
 
         log.info("Cassandra Host(s): %s" % (cassHost))
         log.info("Cassandra Keyspace: %s" % (cassKeyspace))
@@ -72,7 +76,11 @@ class DomsInitializer:
                      auth_provider=auth_provider) as cluster:
             session = cluster.connect()
 
-            self.createKeyspace(session, cassKeyspace)
+            if cassCreateKeyspaceGranted in ["True", "true"]:
+                self.createKeyspace(session, cassKeyspace)
+            else:
+                session.set_keyspace(cassKeyspace)
+
             self.createTables(session)
 
     def override_config(self, first, second):