[icinga-checkins] icinga.org: icinga2/master: API: Fix error message with PUT requests for existing objects

git at icinga.org git at icinga.org
Tue May 17 11:44:09 CEST 2016


Module: icinga2
Branch: master
Commit: 83985f97af89c99efe2631a60b4ee910f960b216
URL:    https://git.icinga.org/?p=icinga2.git;a=commit;h=83985f97af89c99efe2631a60b4ee910f960b216

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Mon May  9 15:08:35 2016 +0200

API: Fix error message with PUT requests for existing objects

fixes #11396

---

 lib/remote/configobjectutility.cpp |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/remote/configobjectutility.cpp b/lib/remote/configobjectutility.cpp
index 13ff484..0656aac 100644
--- a/lib/remote/configobjectutility.cpp
+++ b/lib/remote/configobjectutility.cpp
@@ -111,8 +111,10 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
 	String path = GetObjectConfigPath(type, fullName);
 	Utility::MkDirP(Utility::DirName(path), 0700);
 
-	if (Utility::PathExists(path))
-		BOOST_THROW_EXCEPTION(ScriptError("Configuration file '" + path + "' already exists."));
+	if (Utility::PathExists(path)) {
+		errors->Add("Configuration file '" + path + "' already exists.");
+		return false;
+	}
 
 	std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::trunc);
 	fp << config;



More information about the icinga-checkins mailing list