Merge "update sdnc-image"
authorDan Timoney <dtimoney@att.com>
Wed, 17 Feb 2021 14:22:42 +0000 (14:22 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 17 Feb 2021 14:22:42 +0000 (14:22 +0000)
Former-commit-id: 2e6aaffaaa0b39f3dadfcbe1e659199bc3c59df6

installation/sdnc-web/src/main/scripts/configure.sh
installation/sdnc/src/main/scripts/installCerts.py

index cf53a0d..a257e6e 100644 (file)
@@ -28,7 +28,24 @@ update_index_html() {
  
     # Backup the index.html file
     cp /opt/bitnami/nginx/html/odlux/index.html /opt/bitnami/nginx/html/odlux/index.html.backup
-    sed -z 's/<script>[^<]*<\/script>/<script>\n    \/\/ run the application \n  require\(\[\"connectApp\",\"faultApp\",\"maintenanceApp\",\"configurationApp\",\"performanceHistoryApp\",\"inventoryApp\",\"eventLogApp\",\"mediatorApp\",\"networkMapApp\",\"linkCalculationApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,networkMapApp,linkCalculationApp,helpApp,run\) \{ \n    connectApp.register\(\); \n  faultApp.register\(\);\n    maintenanceApp.register\(\); \n     configurationApp.register\(\);\n    performanceHistoryApp.register\(\); \n    inventoryApp.register\(\);\n    eventLogApp.register\(\);\n   mediatorApp.register\(\);\n   networkMapApp.register\(\);\n   linkCalculationApp.register\(\);\n     helpApp.register\(\);\n      run.runApplication();\n    \}\);\n  <\/script>/' -i /opt/bitnami/nginx/html/odlux/index.html 
+    #default values
+    ODLUX_AUTH_METHOD="basic"
+    ENABLE_ODLUX_RBAC=${ENABLE_ODLUX_RBAC:-false}
+    
+    if [ "$ENABLE_OAUTH" == "true" ]; then
+        ODLUX_AUTH_METHOD="oauth"
+    fi
+    echo "authentication is $ODLUX_AUTH_METHOD"
+    echo "rbac access is enabled: $ENABLE_ODLUX_RBAC"
+    ODLUX_CONFIG='{"authentication":"'$ODLUX_AUTH_METHOD'","enablePolicy":'$ENABLE_ODLUX_RBAC'}'
+#    sed -z 's/<script>[^<]*<\/script>/<script>\n    \/\/ run the application \n  require\(\[\"connectApp\",\"faultApp\",\"maintenanceApp\",\"configurationApp\",\"performanceHistoryApp\",\"inventoryApp\",\"eventLogApp\",\"mediatorApp\",\"networkMapApp\",\"linkCalculationApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,networkMapApp,linkCalculationApp,helpApp,run\) \{ \n run.configure('$ODLUX_CONFIG'); \n    connectApp.register\(\); \n  faultApp.register\(\);\n    maintenanceApp.register\(\); \n     configurationApp.register\(\);\n    performanceHistoryApp.register\(\); \n    inventoryApp.register\(\);\n    eventLogApp.register\(\);\n   mediatorApp.register\(\);\n   networkMapApp.register\(\);\n   linkCalculationApp.register\(\);\n     helpApp.register\(\);\n      run.runApplication();\n    \}\);\n  <\/script>/' -i /opt/bitnami/nginx/html/odlux/index.html 
+
+    #replace require expression
+    sed -z 's/require(\["run"\],\ function\ (run)/require\(\[\"connectApp\",\"faultApp\",\"maintenanceApp\",\"configurationApp\",\"performanceHistoryApp\",\"inventoryApp\",\"eventLogApp\",\"mediatorApp\",\"networkMapApp\",\"linkCalculationApp\",\"helpApp\",\"run\"\], function \(connectApp,faultApp,maintenanceApp,configurationApp,performanceHistoryApp,inventoryApp,eventLogApp,mediatorApp,networkMapApp,linkCalculationApp,helpApp,run\)/' -i /opt/bitnami/nginx/html/odlux/index.html 
+    #replace run.runApplication expression
+    sed -z 's/run.runApplication();/connectApp.register\(\); \n  faultApp.register\(\);\n    maintenanceApp.register\(\); \n     configurationApp.register\(\);\n    performanceHistoryApp.register\(\); \n    inventoryApp.register\(\);\n    eventLogApp.register\(\);\n   mediatorApp.register\(\);\n   networkMapApp.register\(\);\n   linkCalculationApp.register\(\);\n     helpApp.register\(\);\n      run.runApplication();/' -i /opt/bitnami/nginx/html/odlux/index.html 
+    #replace run.configure expression if exists
+    sed -z 's/run.configureApplication([^)]\+)/run.configureApplication('$ODLUX_CONFIG');/' -i /opt/bitnami/nginx/html/odlux/index.html 
 
 }
 
index 677d2c9..2aaa202 100644 (file)
@@ -2,6 +2,7 @@
 #  Copyright (C) 2019 Nordix Foundation.
 # ================================================================================
 #  extended by highstreet technologies GmbH (c) 2020
+#  Copyright (c) 2021 Nokia Intellectual Property.
 # ================================================================================
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -282,6 +283,7 @@ def jks_to_p12(file, password):
 def make_cert_chain(cert_chain, pattern):
     cert_list = []
     if cert_chain:
+        cert_chain = cert_chain.decode('utf-8')
         matches = re.findall(pattern, cert_chain, re.DOTALL | re.MULTILINE)
         for cert in matches:
             cert_list.append(cert.strip())