diff --git a/lib/remote/configstageshandler.cpp b/lib/remote/configstageshandler.cpp index 32d56e39e..673e134a9 100644 --- a/lib/remote/configstageshandler.cpp +++ b/lib/remote/configstageshandler.cpp @@ -98,6 +98,7 @@ void ConfigStagesHandler::HandlePost(const ApiUser::Ptr& user, HttpRequest& requ return HttpUtility::SendJsonError(response, params, 400, "Invalid package name '" + packageName + "'."); bool reload = true; + if (params->Contains("reload")) reload = HttpUtility::GetLastParameter(params, "reload"); @@ -116,13 +117,17 @@ void ConfigStagesHandler::HandlePost(const ApiUser::Ptr& user, HttpRequest& requ ConfigPackageUtility::AsyncTryActivateStage(packageName, stageName, reload); } catch (const std::exception& ex) { return HttpUtility::SendJsonError(response, params, 500, - "Stage creation failed for '" + stageName + "'.", - DiagnosticInformation(ex, false)); + "Stage creation failed.", + DiagnosticInformation(ex)); } String responseStatus = "Created stage. "; - responseStatus += (reload ? " Icinga2 will reload." : " Icinga2 reload skipped."); + + if (reload) + responseStatus += "Reload triggered."; + else + responseStatus += "Reload skipped."; Dictionary::Ptr result1 = new Dictionary({ { "package", packageName }, @@ -163,11 +168,13 @@ void ConfigStagesHandler::HandleDelete(const ApiUser::Ptr& user, HttpRequest& re } catch (const std::exception& ex) { return HttpUtility::SendJsonError(response, params, 500, "Failed to delete stage '" + stageName + "' in package '" + packageName + "'.", - DiagnosticInformation(ex, false)); + DiagnosticInformation(ex)); } Dictionary::Ptr result1 = new Dictionary({ { "code", 200 }, + { "package", packageName }, + { "stage", stageName }, { "status", "Stage deleted." } });