mirror of https://github.com/Icinga/icinga2.git
Split ApiSetupUtility::SetupMaster() into multiple functions
refs #9590
This commit is contained in:
parent
3fe6b56628
commit
f123c8218d
|
@ -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;
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue