You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ap...@apache.org on 2024/12/03 11:50:04 UTC

(ignite-3) branch main updated: IGNITE-23829 Fix --config={} in cluster init (#4820)

This is an automated email from the ASF dual-hosted git repository.

apkhmv pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git


The following commit(s) were added to refs/heads/main by this push:
     new 0108df4500 IGNITE-23829 Fix --config={} in cluster init (#4820)
0108df4500 is described below

commit 0108df45009714ed4b86c683c740f172fd560f71
Author: Aleksandr Pakhomov <ap...@gmail.com>
AuthorDate: Tue Dec 3 14:49:59 2024 +0300

    IGNITE-23829 Fix --config={} in cluster init (#4820)
---
 .../cli/commands/cluster/init/ClusterInitOptions.java        | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java
index f0f041bf64..c584c35087 100644
--- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java
+++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java
@@ -142,6 +142,9 @@ public class ClusterInitOptions {
             return null;
         } else if (clusterConfigOptions.config != null) {
             String config = clusterConfigOptions.config;
+            if (tryParseConfig(config)) {
+                return config;
+            }
             if (checkConfigAsPath(config)) {
                 throw new ConfigAsPathException(config);
             }
@@ -182,6 +185,15 @@ public class ClusterInitOptions {
         }
     }
 
+    private static boolean tryParseConfig(String config) {
+        try {
+            ConfigFactory.parseString(config);
+            return true;
+        } catch (ConfigException e) {
+            return false;
+        }
+    }
+
     private static boolean checkConfigAsPath(String config) {
         try {
             Paths.get(config);