Allow to pass cn to ApiSetupUtility::SetupMaster()

refs #9471
This commit is contained in:
Michael Friedrich 2015-06-25 10:40:50 +02:00
parent 663f09e475
commit 0d977b9d48
3 changed files with 3 additions and 5 deletions

View File

@ -60,7 +60,7 @@ int ApiSetupCommand::Run(const boost::program_options::variables_map& vm, const
* - setup the api on a client? * - setup the api on a client?
*/ */
int result = ApiSetupUtility::SetupMaster(); int result = ApiSetupUtility::SetupMaster(Utility::GetFQDN());
if (result > 0) { if (result > 0) {
Log(LogCritical, "ApiSetup", "Error occured. Bailing out."); Log(LogCritical, "ApiSetup", "Error occured. Bailing out.");

View File

@ -43,7 +43,7 @@ String ApiSetupUtility::GetConfdPath(void)
return Application::GetSysconfDir() + "/icinga2/conf.d"; return Application::GetSysconfDir() + "/icinga2/conf.d";
} }
int ApiSetupUtility::SetupMaster(void) int ApiSetupUtility::SetupMaster(const String& cn)
{ {
/* if the 'api' feature is enabled we can safely assume /* if the 'api' feature is enabled we can safely assume
* that either 'api setup' was run, or the user manually * that either 'api setup' was run, or the user manually
@ -58,8 +58,6 @@ int ApiSetupUtility::SetupMaster(void)
Log(LogInformation, "cli") Log(LogInformation, "cli")
<< "Generating new CA.\n"; << "Generating new CA.\n";
String cn = Utility::GetFQDN();
if (PkiUtility::NewCa() > 0) { if (PkiUtility::NewCa() > 0) {
Log(LogWarning, "cli", "Found CA, skipping and using the existing one."); Log(LogWarning, "cli", "Found CA, skipping and using the existing one.");
} }

View File

@ -37,7 +37,7 @@ namespace icinga
class I2_CLI_API ApiSetupUtility class I2_CLI_API ApiSetupUtility
{ {
public: public:
static int SetupMaster(void); static int SetupMaster(const String& cn);
static String GetConfdPath(void); static String GetConfdPath(void);
private: private: