From 47f4cfac56129379b4553a1c5883cf50e7c2100a Mon Sep 17 00:00:00 2001 From: Jean Francois Denise Date: Thu, 4 Apr 2024 11:50:51 +0200 Subject: [PATCH] provision value is no more case sensitive. Openshift env var are displayed sooner --- .../glow/cli/commands/ScanCommand.java | 9 +++++++- .../openshift/api/OpenShiftSupport.java | 23 ++++++++----------- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java b/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java index abb8c27b..4840a106 100644 --- a/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java +++ b/cli/src/main/java/org/wildfly/glow/cli/commands/ScanCommand.java @@ -68,6 +68,13 @@ public Stability convert(String value) throws Exception { return Stability.fromString(value); } } + private static class ProvisionConverter implements CommandLine.ITypeConverter { + + @Override + public OutputFormat convert(String value) throws Exception { + return OutputFormat.valueOf(value.toUpperCase()); + } + } private static final String ADD_ADD_ONS_MSG = "@|bold To enable add-ons, add the|@ @|fg(yellow) " + Constants.ADD_ONS_OPTION + "=|@ @|bold option to the|@ @|fg(yellow) " @@ -103,7 +110,7 @@ public Stability convert(String value) throws Exception { @CommandLine.Option(names = Constants.INPUT_FEATURE_PACKS_FILE_OPTION, paramLabel = Constants.INPUT_FEATURE_PACKS_FILE_OPTION_LABEL) Optional provisioningXml; - @CommandLine.Option(names = {Constants.PROVISION_OPTION_SHORT, Constants.PROVISION_OPTION}, paramLabel = Constants.PROVISION_OPTION_LABEL) + @CommandLine.Option(converter = ProvisionConverter.class, names = {Constants.PROVISION_OPTION_SHORT, Constants.PROVISION_OPTION}, paramLabel = Constants.PROVISION_OPTION_LABEL) Optional provision; @CommandLine.Option(names = {Constants.PROVISION_OUTPUT_DIR_OPTION_SHORT, Constants.PROVISION_OUTPUT_DIR_OPTION}, paramLabel = Constants.PROVISION_OUTPUT_DIR_LABEL) diff --git a/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftSupport.java b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftSupport.java index c5cb4e1c..def5b75f 100644 --- a/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftSupport.java +++ b/openshift-deployment/api/src/main/java/org/wildfly/glow/deployment/openshift/api/OpenShiftSupport.java @@ -286,23 +286,20 @@ public static void deploy(GlowMessageWriter writer, } } writer.info("\nThe active deployers have resolved the environment variables required at build time and deployment time."); - + actualEnv.put("APPLICATION_ROUTE_HOST", host); + actualEnv.putAll(extraEnv); + if (!disabledDeployers.isEmpty()) { + writer.warn("\nThe following environment variables will be set in the " + appName + " deployment. Make sure that the required env variables for the disabled deployer(s) have been set:\n"); + } else { + writer.warn("\nThe following environment variables will be set in the " + appName + " deployment:\n"); + } + for (Entry entry : actualEnv.entrySet()) { + writer.warn(entry.getKey() + "=" + entry.getValue()); + } // Can be overriden by user actualBuildEnv.putAll(buildExtraEnv); createBuild(writer, target, osClient, appName, initScript, cliScript, actualBuildEnv, config); - actualEnv.put("APPLICATION_ROUTE_HOST", host); - actualEnv.putAll(extraEnv); writer.info("Deploying application image on OpenShift"); - if (!actualEnv.isEmpty()) { - if (!disabledDeployers.isEmpty()) { - writer.warn("\nThe following environment variables have been set in the " + appName + " deployment. Make sure that the required env variables for the disabled deployer(s) have been set:\n"); - } else { - writer.warn("\nThe following environment variables have been set in the " + appName + " deployment:\n"); - } - for (Entry entry : actualEnv.entrySet()) { - writer.warn(entry.getKey() + "=" + entry.getValue()); - } - } createAppDeployment(writer, target, osClient, appName, actualEnv, ha); writer.info("\nApplication route: https://" + host + ("ROOT.war".equals(appName) ? "" : "/" + appName)); }