]> granicus.if.org Git - icinga2/commitdiff
Update default port behaviour in node wizard
authorJean Flach <jean-marcel.flach@netways.de>
Fri, 27 Nov 2015 15:36:37 +0000 (16:36 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Tue, 8 Dec 2015 14:47:00 +0000 (15:47 +0100)
fixes #10728

lib/cli/nodewizardcommand.cpp

index a143682763ddc293b72d5b75374e4c37f3cbc895..bbf4fd2b6407a3667c67421312b32661c2d9d264 100644 (file)
@@ -182,6 +182,8 @@ wizard_endpoint_loop_start:
                boost::algorithm::to_lower(answer);
                choice = answer;
 
+               String tmpPort = "5665";
+
                if (choice.Contains("n")) {
                        Log(LogWarning, "cli", "Node to master connection setup skipped");
                        std::cout << "Connection setup skipped. Please configure your master to connect to this node.\n";
@@ -208,17 +210,15 @@ wizard_endpoint_loop_start:
 
                        std::cout << ConsoleColorTag(Console_Bold)
                             << "Master endpoint port" << ConsoleColorTag(Console_Normal)
-                            << " [5665]: ";
+                            << " [" << tmpPort << "]: ";
 
                        std::getline(std::cin, answer);
                        boost::algorithm::to_lower(answer);
 
                        if (!answer.empty())
-                               tmp = answer;
-                       else
-                               tmp = "5665";
+                               tmpPort = answer;
 
-                       endpoint_buffer += "," + tmp.Trim();
+                       endpoint_buffer += "," + tmpPort.Trim();
                }
 
                endpoints.push_back(endpoint_buffer);
@@ -255,15 +255,15 @@ wizard_master_host:
                master_host = master_host.Trim();
 
                std::cout << ConsoleColorTag(Console_Bold) << "Port"
-                   << ConsoleColorTag(Console_Normal) << " [5665]: ";
+                   << ConsoleColorTag(Console_Normal) << " [" << tmpPort << "]: ";
 
                std::getline(std::cin, answer);
                boost::algorithm::to_lower(answer);
 
-               if (answer.empty())
-                       answer = "5665";
+               if (!answer.empty())
+                       tmpPort = answer;
 
-               String master_port = answer;
+               String master_port = tmpPort;
                master_port = master_port.Trim();
 
                /* workaround for fetching the master cert */