From 460d858a8e1fc1f742640a6823b1d9a8fd9b7766 Mon Sep 17 00:00:00 2001 From: Jean-Marcel Flach Date: Mon, 20 Apr 2015 10:51:18 +0200 Subject: [PATCH] Change node wizard flow fixes #8891 --- lib/cli/nodewizardcommand.cpp | 38 +++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/cli/nodewizardcommand.cpp b/lib/cli/nodewizardcommand.cpp index dde58e0fa..ddc03553c 100644 --- a/lib/cli/nodewizardcommand.cpp +++ b/lib/cli/nodewizardcommand.cpp @@ -160,33 +160,49 @@ wizard_endpoint_loop_start: endpoint_buffer = answer; endpoint_buffer.Trim(); - std::cout << ConsoleColorTag(Console_Bold) << "Please fill out the master connection information:" << ConsoleColorTag(Console_Normal) << "\n"; - std::cout << ConsoleColorTag(Console_Bold) << "Master endpoint host" << ConsoleColorTag(Console_Normal) << " (optional, your master's IP address or FQDN): "; + std::cout << "Do you want to establish a connection to the master " << ConsoleColorTag(Console_Bold) << "now " << ConsoleColorTag(Console_Normal) << " [Y/n]? "; - std::getline(std::cin, answer); + std::getline (std::cin, answer); boost::algorithm::to_lower(answer); + choice = answer; + + if (choice.Contains("n")) { + Log(LogWarning, "cli", "Node to master connection setup skipped"); + std::cout << "Connection setup skipped, you know hat you are doing.\n"; + } else { + std::cout << ConsoleColorTag(Console_Bold) << "Please fill out the master connection information:" << ConsoleColorTag(Console_Normal) << "\n"; + std::cout << ConsoleColorTag(Console_Bold) << "Master endpoint host" << ConsoleColorTag(Console_Normal) << " (Your master's IP address or FQDN): "; + + std::getline(std::cin, answer); + boost::algorithm::to_lower(answer); + + if (answer.empty()) { + Log(LogWarning, "cli", "Please enter the masters endpoint data"); + goto wizard_endpoint_loop_start; + } - if (!answer.empty()) { String tmp = answer; tmp.Trim(); endpoint_buffer += "," + tmp; master_endpoint_name = tmp; //store the endpoint name for later - } - std::cout << ConsoleColorTag(Console_Bold) << "Master endpoint port" << ConsoleColorTag(Console_Normal) << " (optional) []: "; + std::cout << ConsoleColorTag(Console_Bold) << "Master endpoint port" << ConsoleColorTag(Console_Normal) << " [5665]: "; - std::getline(std::cin, answer); - boost::algorithm::to_lower(answer); + std::getline(std::cin, answer); + boost::algorithm::to_lower(answer); + + if (!answer.empty()) + tmp = answer; + else + tmp = "5665"; - if (!answer.empty()) { - String tmp = answer; tmp.Trim(); endpoint_buffer += "," + answer; } endpoints.push_back(endpoint_buffer); - std::cout << ConsoleColorTag(Console_Bold) << "Add more master endpoints?" << ConsoleColorTag(Console_Normal) << " [y/N]"; + std::cout << ConsoleColorTag(Console_Bold) << "Add more master endpoints?" << ConsoleColorTag(Console_Normal) << " [y/N]: "; std::getline (std::cin, answer); boost::algorithm::to_lower(answer); -- 2.40.0