1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #include "cli/apisetupcommand.hpp"
4 #include "cli/apisetuputility.hpp"
5 #include "cli/variableutility.hpp"
6 #include "base/logger.hpp"
7 #include "base/console.hpp"
10 using namespace icinga;
11 namespace po = boost::program_options;
13 REGISTER_CLICOMMAND("api/setup", ApiSetupCommand);
15 String ApiSetupCommand::GetDescription() const
17 return "Setup for Icinga 2 API.";
20 String ApiSetupCommand::GetShortDescription() const
22 return "setup for API";
25 ImpersonationLevel ApiSetupCommand::GetImpersonationLevel() const
27 return ImpersonateIcinga;
30 int ApiSetupCommand::GetMaxArguments() const
36 * The entry point for the "api setup" CLI command.
38 * @returns An exit status.
40 int ApiSetupCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
42 String cn = VariableUtility::GetVariable("NodeName");
45 cn = Utility::GetFQDN();
47 if (!ApiSetupUtility::SetupMaster(cn, true))