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 4b5108fa..f9765c31 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 @@ -424,7 +424,6 @@ public Integer call() throws Exception { } if (OutputFormat.OPENSHIFT.equals(provision.get())) { OpenShiftSupport.deploy(deployments, - "app-from-glow", GlowMessageWriter.DEFAULT, target, scanResults, 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 27f4e15e..a8e5f2c7 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 @@ -333,7 +333,6 @@ static final String generateValidName(String name) { } public static void deploy(List deployments, - String defaultName, GlowMessageWriter writer, Path target, ScanResults scanResults, @@ -351,16 +350,21 @@ public static void deploy(List deployments, Set metadataOnlyLayers = scanResults.getMetadataOnlyLayers(); Map> requiredBuildTime = scanResults.getSuggestions().getBuildTimeRequiredConfigurations(); String appName = ""; - Path deploymentsDir = target.resolve("deployments"); - Files.createDirectories(deploymentsDir); - for (Path p : deployments) { - Files.copy(p, deploymentsDir.resolve(p.getFileName())); - int ext = p.getFileName().toString().lastIndexOf("."); - appName += p.getFileName().toString().substring(0, ext); - appName = generateValidName(appName); - } - if (appName.isEmpty()) { - appName = defaultName; + String originalAppName = null; + if (deployments != null && !deployments.isEmpty()) { + Path deploymentsDir = target.resolve("deployments"); + Files.createDirectories(deploymentsDir); + for (Path p : deployments) { + Files.copy(p, deploymentsDir.resolve(p.getFileName())); + int ext = p.getFileName().toString().lastIndexOf("."); + appName += p.getFileName().toString().substring(0, ext); + if (originalAppName == null) { + originalAppName = appName; + } + appName = generateValidName(appName); + } + } else { + throw new Exception("No application to deploy to OpenShift"); } Map env = new HashMap<>(); for (Set envs : scanResults.getSuggestions().getStronglySuggestedConfigurations().values()) { @@ -448,7 +452,7 @@ public static void deploy(List deployments, createBuild(writer, target, osClient, appName, initScript, cliScript, actualBuildEnv, config, serverImageBuildLabels); writer.info("Deploying application image on OpenShift"); createAppDeployment(writer, target, osClient, appName, actualEnv, ha, config, deploymentKind); - writer.info("Application route: https://" + host + ("ROOT.war".equals(appName) ? "" : "/" + appName)); + writer.info("Application route: https://" + host + ( "ROOT.war".equals(appName) ? "" : "/" + originalAppName)); } private static void createBuild(GlowMessageWriter writer,