From: Michael Friedrich Date: Fri, 11 Dec 2015 16:03:07 +0000 (+0100) Subject: Add more debug logging for api package config sync X-Git-Tag: v2.4.2~137 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f0a1872e3b5b6238b6a044cad35e34faa86de84c;p=icinga2 Add more debug logging for api package config sync refs #10819 --- diff --git a/lib/remote/apilistener-filesync.cpp b/lib/remote/apilistener-filesync.cpp index 891deab96..1556be227 100644 --- a/lib/remote/apilistener-filesync.cpp +++ b/lib/remote/apilistener-filesync.cpp @@ -34,7 +34,17 @@ REGISTER_APIFUNCTION(Update, config, &ApiListener::ConfigUpdateHandler); bool ApiListener::IsConfigMaster(const Zone::Ptr& zone) { - return !ConfigCompiler::GetZoneDirs(zone->GetName()).empty(); + std::vector zoneDirs = ConfigCompiler::GetZoneDirs(zone->GetName()); + + std::vector paths; + BOOST_FOREACH(const ZoneFragment& zf, zoneDirs) { + paths.push_back(zf.Path); + } + + Log(LogNotice, "ApiListener") + << "Registered config directories for zone '" << zone->GetName() << "': " << Utility::NaturalJoin(paths); + + return zoneDirs.size() > 0; } void ApiListener::ConfigGlobHandler(Dictionary::Ptr& config, const String& path, const String& file) @@ -146,8 +156,11 @@ void ApiListener::SyncZoneDir(const Zone::Ptr& zone) const void ApiListener::SyncZoneDirs(void) const { BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType()) { - if (!IsConfigMaster(zone)) + if (!IsConfigMaster(zone)) { + Log(LogWarning, "ApiListener") + << "Not syncing config update for zone '" << zone->GetName() << "' because we do not have an authoritative version of the zone's config."; continue; + } try { SyncZoneDir(zone);