]> granicus.if.org Git - icinga2/commitdiff
Split ApiSetupUtility::SetupMaster() into multiple functions
authorMichael Friedrich <michael.friedrich@netways.de>
Wed, 8 Jul 2015 13:32:11 +0000 (15:32 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Wed, 8 Jul 2015 13:32:11 +0000 (15:32 +0200)
refs #9590

lib/cli/apisetuputility.cpp
lib/cli/apisetuputility.hpp

index 46314f5fa6854b2c11361f2b08e041b54c144670..ef641a52632ac413487bfa4629436509586a9ebd 100644 (file)
@@ -55,6 +55,15 @@ int ApiSetupUtility::SetupMaster(const String& cn)
                return 0;
        }
 
+       SetupMasterCertificates(cn);
+       SetupMasterApiUser(cn);
+       SetupMasterEnableApi(cn);
+
+       return 0;
+}
+
+int ApiSetupUtility::SetupMasterCertificates(const String& cn)
+{
        Log(LogInformation, "cli")
            << "Generating new CA.\n";
 
@@ -143,6 +152,11 @@ int ApiSetupUtility::SetupMaster(const String& cn)
                }
        }
 
+       return 0;
+}
+
+int ApiSetupUtility::SetupMasterApiUser(const String& cn)
+{
        String api_username = "root"; //TODO make this available as cli parameter?
        String api_password = RandomString(8);
        String apiuserspath = GetConfdPath() + "/api-users.conf";
@@ -178,7 +192,11 @@ int ApiSetupUtility::SetupMaster(const String& cn)
                    << boost::errinfo_file_name(apiuserspathtmp));
        }
 
+       return 0;
+}
 
+int ApiSetupUtility::SetupMasterEnableApi(const String& cn)
+{
        Log(LogInformation, "cli", "Enabling the ApiListener feature.\n");
 
        std::vector<std::string> enable;
index ce8ceb8dd48865530080197eb42708f9433fb951..b6c36c2a65c5abe743bb6faabc02f21597c12d04 100644 (file)
@@ -38,6 +38,11 @@ class I2_CLI_API ApiSetupUtility
 {
 public:
        static int SetupMaster(const String& cn);
+
+       static int SetupMasterCertificates(const String& cn);
+       static int SetupMasterApiUser(const String& cn);
+       static int SetupMasterEnableApi(const String& cn);
+
        static String GetConfdPath(void);
 
 private: