From: Michael Friedrich Date: Sun, 2 Nov 2014 16:45:51 +0000 (+0100) Subject: Cli: Better output formatting for 'node wizard' X-Git-Tag: v2.2.0~146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a751dc035313cb7eac7bdf59d387237c33fc67e3;p=icinga2 Cli: Better output formatting for 'node wizard' --- diff --git a/lib/cli/nodewizardcommand.cpp b/lib/cli/nodewizardcommand.cpp index cc5850228..406b93cb0 100644 --- a/lib/cli/nodewizardcommand.cpp +++ b/lib/cli/nodewizardcommand.cpp @@ -100,7 +100,7 @@ int NodeWizardCommand::Run(const boost::program_options::variables_map& vm, cons std::string answer; bool is_node_setup = true; - std::cout << "Please specify if this is an node setup ('no' installs a master setup) [Y/n]: "; + std::cout << "Please specify if this is a satellite setup ('n' installs a master setup) [Y/n]: "; std::getline (std::cin, answer); boost::algorithm::to_lower(answer); @@ -450,15 +450,20 @@ wizard_ticket: String key = pki_path + "/" + cn + ".key"; String csr = pki_path + "/" + cn + ".csr"; + Log(LogInformation, "cli") + << "Generating new CSR in '" << csr << "'."; + if (PkiUtility::NewCert(cn, key, csr, "") > 0) { - Log(LogCritical, "cli", "Failed to create self-signed certificate"); + Log(LogCritical, "cli", "Failed to create certificate signing request."); return 1; } /* Sign the CSR with the CA key */ - String cert = pki_path + "/" + cn + ".crt"; + Log(LogInformation, "cli") + << "Signing CSR with CA and writing certificate to '" << cert << "'."; + if (PkiUtility::SignCsr(csr, cert) != 0) { Log(LogCritical, "cli", "Could not sign CSR."); return 1; @@ -523,7 +528,7 @@ wizard_ticket: String bind_port = answer; bind_port.Trim(); - std::cout << "Enabling the APIlistener feature.\n"; + Log(LogInformation, "cli", "Enabling the APIlistener feature."); std::vector enable; enable.push_back("api"); @@ -575,7 +580,9 @@ wizard_ticket: Log(LogInformation, "cli", "Updating constants.conf."); - NodeUtility::CreateBackupFile(Application::GetSysconfDir() + "/icinga2/constants.conf"); + String constants_file = Application::GetSysconfDir() + "/icinga2/constants.conf"; + + NodeUtility::CreateBackupFile(constants_file); NodeUtility::UpdateConstant("NodeName", cn); @@ -584,10 +591,12 @@ wizard_ticket: NodeUtility::UpdateConstant("TicketSalt", salt); Log(LogInformation, "cli") - << "Edit the api feature config file '" << apipath << "' and set a secure 'ticket_salt' attribute."; + << "Edit the constants.conf file '" << constants_file << "' and set a secure 'TicketSalt' constant."; } - std::cout << "Now restart your Icinga 2 to finish the installation!\n"; + std::cout << "Done.\n\n"; + + std::cout << "Now restart your Icinga 2 daemon to finish the installation!\n\n"; std::cout << "If you encounter problems or bugs, please do not hesitate to\n" << "get in touch with the community at https://support.icinga.org" << std::endl;