From 0d977b9d480fa797c6066d8bff7f402f5c620728 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Thu, 25 Jun 2015 10:40:50 +0200 Subject: [PATCH] Allow to pass cn to ApiSetupUtility::SetupMaster() refs #9471 --- lib/cli/apisetupcommand.cpp | 2 +- lib/cli/apisetuputility.cpp | 4 +--- lib/cli/apisetuputility.hpp | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/cli/apisetupcommand.cpp b/lib/cli/apisetupcommand.cpp index 5bad6d710..47738006c 100644 --- a/lib/cli/apisetupcommand.cpp +++ b/lib/cli/apisetupcommand.cpp @@ -60,7 +60,7 @@ int ApiSetupCommand::Run(const boost::program_options::variables_map& vm, const * - setup the api on a client? */ - int result = ApiSetupUtility::SetupMaster(); + int result = ApiSetupUtility::SetupMaster(Utility::GetFQDN()); if (result > 0) { Log(LogCritical, "ApiSetup", "Error occured. Bailing out."); diff --git a/lib/cli/apisetuputility.cpp b/lib/cli/apisetuputility.cpp index 5694d7059..0c7ed775f 100644 --- a/lib/cli/apisetuputility.cpp +++ b/lib/cli/apisetuputility.cpp @@ -43,7 +43,7 @@ String ApiSetupUtility::GetConfdPath(void) 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 * that either 'api setup' was run, or the user manually @@ -58,8 +58,6 @@ int ApiSetupUtility::SetupMaster(void) Log(LogInformation, "cli") << "Generating new CA.\n"; - String cn = Utility::GetFQDN(); - if (PkiUtility::NewCa() > 0) { Log(LogWarning, "cli", "Found CA, skipping and using the existing one."); } diff --git a/lib/cli/apisetuputility.hpp b/lib/cli/apisetuputility.hpp index eb5a1321c..ce8ceb8dd 100644 --- a/lib/cli/apisetuputility.hpp +++ b/lib/cli/apisetuputility.hpp @@ -37,7 +37,7 @@ namespace icinga class I2_CLI_API ApiSetupUtility { public: - static int SetupMaster(void); + static int SetupMaster(const String& cn); static String GetConfdPath(void); private: -- 2.40.0