Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IGNITE-24080 Fix config path reading in CLI init command #5001

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ private static boolean tryParseConfig(String config) {

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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -66,8 +67,9 @@ private FlowBuilder<String, ClusterInitCallInput> askQuestionIfConfigIsPath() {
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,
Expand Down