From b785674ab261833128a83c8101aee3d177e73ebc Mon Sep 17 00:00:00 2001 From: Michael Insel Date: Thu, 1 Nov 2018 19:16:26 +0100 Subject: [PATCH] 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. --- lib/cli/apisetuputility.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/cli/apisetuputility.cpp b/lib/cli/apisetuputility.cpp index f8b12bacb..a78409212 100644 --- a/lib/cli/apisetuputility.cpp +++ b/lib/cli/apisetuputility.cpp @@ -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";