Fix api setup to automatically create the conf.d directory

This patch creates the conf.d directory automatically when it is not present during api setup.
This commit is contained in:
Michael Insel 2018-11-01 19:16:26 +01:00
parent 13e54d960d
commit b785674ab2
1 changed files with 9 additions and 0 deletions

View File

@ -152,6 +152,15 @@ bool ApiSetupUtility::SetupMasterCertificates(const String& cn)
bool ApiSetupUtility::SetupMasterApiUser()
{
if (!Utility::PathExists(GetConfdPath())) {
Log(LogWarning, "cli")
<< "Path '" << GetConfdPath() << "' do not exist.";
Log(LogInformation, "cli")
<< "Creating path '" << GetConfdPath() << "'.";
Utility::MkDirP(GetConfdPath(), 0755);
}
String api_username = "root"; // TODO make this available as cli parameter?
String api_password = RandomString(8);
String apiUsersPath = GetConfdPath() + "/api-users.conf";