From f9a52bd67f2f329f3686d9a237227e47f8b1820b Mon Sep 17 00:00:00 2001 From: zeroflag Date: Wed, 12 Jul 2023 13:08:56 +0200 Subject: [PATCH] KNOX-2936 - knoxcli convert-topology doesn't work with output-path parameter --- .../src/main/java/org/apache/knox/gateway/util/KnoxCLI.java | 2 +- .../org/apache/knox/gateway/util/TopologyToDescriptor.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java index f343e2ecf5..bdeb8ad229 100644 --- a/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java +++ b/gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java @@ -2303,7 +2303,7 @@ public class TopologyConverter extends Command { + "--descriptor-name (optional) name of descriptor json config file (including .json extension) \n" + "--topology-name (optional) topology-name can be use instead of --path option, if used, KnoxCLI will attempt to find topology from deployed topologies.\n" + "\t if not provided topology name will be used as descriptor name \n" - + "--output-path (optional) output directory to save provider and descriptor config files \n" + + "--output-dir (optional) output directory to save provider and descriptor config files \n" + "\t if not provided config files will be saved in appropriate Knox config directory \n" + "--force (optional) force rewriting of existing files, if not used, command will fail when the configs files with same name already exist. \n" + "--cluster (optional) cluster name, required for service discovery \n" diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java b/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java index 316690138a..0d3c67f9a3 100644 --- a/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java +++ b/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java @@ -227,7 +227,9 @@ private void fileCheck(final File file) throws IOException { file.getAbsolutePath())); } /* make sure file and directories are in place */ - Files.createDirectories(file.toPath().getParent()); + if (!file.getParentFile().exists()) { + Files.createDirectories(file.toPath().getParent()); + } file.createNewFile(); }