mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-23 13:45:04 +02:00
Merge pull request #6808 from Icinga/bugfix/put-request-0-byte-file-3937
Remove redundand check for object existence on creation via API
This commit is contained in:
commit
5ef23ee06d
@ -120,11 +120,6 @@ bool ConfigObjectUtility::CreateObject(const Type::Ptr& type, const String& full
|
|||||||
String path = GetObjectConfigPath(type, fullName);
|
String path = GetObjectConfigPath(type, fullName);
|
||||||
Utility::MkDirP(Utility::DirName(path), 0700);
|
Utility::MkDirP(Utility::DirName(path), 0700);
|
||||||
|
|
||||||
if (Utility::PathExists(path)) {
|
|
||||||
errors->Add("Cannot create object '" + fullName + "'. Configuration file '" + path + "' already exists.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::trunc);
|
std::ofstream fp(path.CStr(), std::ofstream::out | std::ostream::trunc);
|
||||||
fp << config;
|
fp << config;
|
||||||
fp.close();
|
fp.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user