This is an automated email from the ASF dual-hosted git repository.
mpochatkin 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 63d1101454 IGNITE-24080 Fix config path reading in CLI init command
63d1101454 is described below
commit 63d11014544d6306a7464ceb0b7a0e1623f12226
Author: Mikhail Pochatkin <[email protected]>
AuthorDate: Tue Jan 7 15:52:53 2025 +0300
IGNITE-24080 Fix config path reading in CLI init command
---
.../internal/cli/commands/cluster/init/ClusterInitOptions.java | 4 ++--
.../internal/cli/commands/cluster/init/ClusterInitReplCommand.java | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
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 0d0d5f9619..92cb903aaf 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
@@ -201,8 +201,8 @@ public class ClusterInitOptions {
private static boolean checkConfigAsPath(String config) {
try {
- Paths.get(config);
- return true;
+ Path path = Paths.get(config);
+ return Files.exists(path);
} catch (InvalidPathException e) {
return false;
}
diff --git
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitReplCommand.java
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitReplCommand.java
index 0cf94f8eff..a3715cb237 100644
---
a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitReplCommand.java
+++
b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitReplCommand.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.cli.commands.cluster.init;
+import static
org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_CONFIG_OPTION;
import static
org.apache.ignite.internal.cli.core.style.component.QuestionUiComponent.fromYesNoQuestion;
import static picocli.CommandLine.Command;
@@ -66,8 +67,9 @@ public class ClusterInitReplCommand extends BaseCommand
implements Runnable {
return Flows.from(this::buildCallInput);
} catch (ConfigAsPathException e) {
QuestionUiComponent questionUiComponent = fromYesNoQuestion(
- "It seems that you passed the path to the config file to
the config content option. "
- + "Do you want this file to be read as a config?"
+ "It seems that you have passed the path to the
configuration file in the configuration content "
+ + CLUSTER_CONFIG_OPTION + " option. "
+ + "Do you want to read cluster configuration from
this file?"
);
return Flows.acceptQuestion(questionUiComponent,