mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-24 06:05:01 +02:00
parent
7c4fa22715
commit
2484016c54
@ -612,13 +612,13 @@ void Utility::MkDir(const String& path, int flags)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Utility::MkDirP(const String& path, int flags)
|
void Utility::MkDirP(const String& path, int mode)
|
||||||
{
|
{
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
|
||||||
while (pos != String::NPos) {
|
while (pos != String::NPos) {
|
||||||
pos = path.Find("/", pos + 1);
|
pos = path.Find("/", pos + 1);
|
||||||
MkDir(path.SubStr(0, pos), flags);
|
MkDir(path.SubStr(0, pos), mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ public:
|
|||||||
|
|
||||||
static bool Glob(const String& pathSpec, const boost::function<void (const String&)>& callback, int type = GlobFile | GlobDirectory);
|
static bool Glob(const String& pathSpec, const boost::function<void (const String&)>& callback, int type = GlobFile | GlobDirectory);
|
||||||
static bool GlobRecursive(const String& path, const String& pattern, const boost::function<void (const String&)>& callback, int type = GlobFile | GlobDirectory);
|
static bool GlobRecursive(const String& path, const String& pattern, const boost::function<void (const String&)>& callback, int type = GlobFile | GlobDirectory);
|
||||||
static void MkDir(const String& path, int flags);
|
static void MkDir(const String& path, int mode);
|
||||||
static void MkDirP(const String& path, int flags);
|
static void MkDirP(const String& path, int mode);
|
||||||
static bool SetFileOwnership(const String& file, const String& user, const String& group);
|
static bool SetFileOwnership(const String& file, const String& user, const String& group);
|
||||||
|
|
||||||
static void QueueAsyncCallback(const boost::function<void (void)>& callback, SchedulerPolicy policy = DefaultScheduler);
|
static void QueueAsyncCallback(const boost::function<void (void)>& callback, SchedulerPolicy policy = DefaultScheduler);
|
||||||
|
@ -232,12 +232,13 @@ bool RepositoryUtility::AddObject(const std::vector<String>& object_paths, const
|
|||||||
|
|
||||||
if (check_config) {
|
if (check_config) {
|
||||||
try {
|
try {
|
||||||
Object::Ptr object = utype->Instantiate();
|
ConfigObject::Ptr object = static_pointer_cast<ConfigObject>(utype->Instantiate());
|
||||||
Deserialize(object, attrs, false, FAConfig);
|
Deserialize(object, attrs, false, FAConfig);
|
||||||
|
object->SetName(name);
|
||||||
|
|
||||||
RepositoryValidationUtils utils;
|
RepositoryValidationUtils utils;
|
||||||
static_pointer_cast<ConfigObject>(object)->Validate(FAConfig, utils);
|
static_pointer_cast<ConfigObject>(object)->Validate(FAConfig, utils);
|
||||||
} catch (const ScriptError& ex) {
|
} catch (const ValidationError& ex) {
|
||||||
Log(LogCritical, "config", DiagnosticInformation(ex));
|
Log(LogCritical, "config", DiagnosticInformation(ex));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -555,6 +556,8 @@ bool RepositoryUtility::GetChangeLog(const boost::function<void (const Dictionar
|
|||||||
std::vector<String> changelog;
|
std::vector<String> changelog;
|
||||||
String path = GetRepositoryChangeLogPath() + "/";
|
String path = GetRepositoryChangeLogPath() + "/";
|
||||||
|
|
||||||
|
Utility::MkDirP(path, 0700);
|
||||||
|
|
||||||
Utility::Glob(path + "/*.change",
|
Utility::Glob(path + "/*.change",
|
||||||
boost::bind(&RepositoryUtility::CollectChangeLog, _1, boost::ref(changelog)), GlobFile);
|
boost::bind(&RepositoryUtility::CollectChangeLog, _1, boost::ref(changelog)), GlobFile);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user