]> granicus.if.org Git - icinga2/commitdiff
Add more debug logging for api package config sync
authorMichael Friedrich <michael.friedrich@netways.de>
Fri, 11 Dec 2015 16:03:07 +0000 (17:03 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Tue, 23 Feb 2016 08:09:55 +0000 (09:09 +0100)
refs #10819

lib/remote/apilistener-filesync.cpp

index 891deab9671f33c2644e3d9a327361df8c57c423..1556be227ee0321ceff00f52dd63380e8f8221c1 100644 (file)
@@ -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<ZoneFragment> zoneDirs = ConfigCompiler::GetZoneDirs(zone->GetName());
+
+       std::vector<String> 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<Zone>()) {
-               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);