]> granicus.if.org Git - icinga2/commitdiff
API: Fix error message with PUT requests for existing objects
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 9 May 2016 13:08:35 +0000 (15:08 +0200)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 9 May 2016 13:08:35 +0000 (15:08 +0200)
fixes #11396

lib/remote/configobjectutility.cpp

index 13ff4841dbed98e0a2d62781efacc299630aa87c..0656aac799b7671b27f75aa5b8f1875891aacbf9 100644 (file)
@@ -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;