From 774a85f0837d22184df3fcc40ee496d90103c835 Mon Sep 17 00:00:00 2001 From: wcgunter Date: Wed, 21 Feb 2024 16:31:07 -0500 Subject: [PATCH] Move fetching of versions from configs to system vars --- ci/ci.sh | 6 ------ .../main/java/jpl/cws/task/CwsInstaller.java | 19 ------------------- .../main/java/jpl/cws/controller/MvcCore.java | 13 +++---------- utils.sh | 5 +---- 4 files changed, 4 insertions(+), 39 deletions(-) diff --git a/ci/ci.sh b/ci/ci.sh index de585416..7a54d7aa 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -123,9 +123,6 @@ default_cws_auth_scheme=CAMUNDA default_history_level=full default_shutdown_port=38005 metrics_publishing_interval=10 -camunda_version=${CAMUNDA_VER} -java_version=${JAVA_HOME_VERSION} -java_home=${JAVA_HOME} EOF @@ -184,9 +181,6 @@ aws_cloudwatch_endpoint=monitoring.us-west-1.amazonaws.com default_history_level=full default_shutdown_port=38005 metrics_publishing_interval=10 -camunda_version=${CAMUNDA_VER} -java_version=${JAVA_HOME_VERSION} -java_home=${JAVA_HOME} EOF diff --git a/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java b/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java index 5ae939f1..71da8ac9 100755 --- a/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java +++ b/cws-installer/src/main/java/jpl/cws/task/CwsInstaller.java @@ -236,11 +236,6 @@ public class CwsInstaller { private static String aws_sqs_dispatcher_sqsUrl; private static String aws_sqs_dispatcher_msgFetchLimit; - private static String camunda_version; - - private static String java_version; - private static String java_home = System.getenv("JAVA_HOME"); - private static Boolean reconfigure = false; @@ -265,8 +260,6 @@ public static void main(String args[]) { } getVersion(); - getCamundaVersion(); - getJavaVersion(); getOsName(); getTotalPhysicalMemory(); checkCompiler(); @@ -386,14 +379,6 @@ private static void getVersion() { cws_version = getenv("CWS_VER"); } - private static void getCamundaVersion() { - camunda_version = getenv("CAMUNDA_VER"); - } - - private static void getJavaVersion() { - java_version = getenv("JAVA_HOME_VERSION"); - } - private static void getOsName() { osName = getProperty("os.name"); } @@ -3033,10 +3018,6 @@ private static void updateCwsUiProperties() throws IOException { content = content.replace("__AWS_SQS_DISPATCHER_MSG_FETCH_LIMIT__", aws_sqs_dispatcher_msgFetchLimit); } - content = content.replace("__CWS_CAMUNDA_VERSION__", camunda_version); - content = content.replace("__CWS_JAVA_VERSION__", java_version); - content = content.replace("__CWS_JAVA_HOME__", java_home); - writeToFile(filePath, content); copy( Paths.get(config_work_dir + SEP + "cws-ui" + SEP + "cws-ui.properties"), diff --git a/cws-service/src/main/java/jpl/cws/controller/MvcCore.java b/cws-service/src/main/java/jpl/cws/controller/MvcCore.java index 0c246098..48936709 100755 --- a/cws-service/src/main/java/jpl/cws/controller/MvcCore.java +++ b/cws-service/src/main/java/jpl/cws/controller/MvcCore.java @@ -40,11 +40,6 @@ public class MvcCore { @Value("${cws.history.days.to.live}") private String historyDaysToLive; @Value("${cws.history.level}") private String historyLevel; - @Value("${cws.camunda.version}") private String camundaVersion; - - @Value("${cws.java.home}") private String javaHome; - @Value("${cws.java.version}") private String javaVersion; - public MvcCore() {} protected ModelAndView buildModel(String page, String message) { @@ -188,11 +183,9 @@ protected ModelAndView buildConfigurationModel(String message) { model.addObject("tomcatWebapps", tomcatWebapps); model.addObject("historyDaysToLive", historyDaysToLive); model.addObject("historyLevel", historyLevel); - - model.addObject("camundaVersion", camundaVersion); - - model.addObject("javaHome", javaHome); - model.addObject("javaVersion", javaVersion); + model.addObject("javaHome", System.getenv("JAVA_HOME")); + model.addObject("javaVersion", System.getenv("JAVA_HOME_VERSION")); + model.addObject("camundaVersion", System.getenv("CAMUNDA_VER")); DiskUsage diskUsage = cwsConsoleService.getDiskUsage(); diff --git a/utils.sh b/utils.sh index 0f4d9cc4..59d3d590 100755 --- a/utils.sh +++ b/utils.sh @@ -140,7 +140,7 @@ function check_java_requirements () { JAVA_HOME_VERSION=$("${JAVA_HOME}/bin/java" -version 2>&1 | awk -F '"' '/version/ {print $2}') print " JAVA_HOME Java version : ${JAVA_HOME_VERSION}" - export JAVA_HOME_VERSION + export JAVA_HOME_VERSION="${JAVA_HOME_VERSION}" JAVA_PATH_VERSION=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}') print " PATH Java version : ${JAVA_PATH_VERSION} $(which java)" @@ -320,8 +320,5 @@ function auto_conf_data () { cws_notification_emails=${NOTIFICATION_EMAILS} cws_token_expiration_hours=240 user_provided_logstash=n - camunda_version=${CAMUNDA_VER} - java_version=${JAVA_HOME_VERSION} - java_home=${JAVA_HOME} EOF }