]> granicus.if.org Git - icinga2/commitdiff
Update log message and implement recursive diff delete
authorMichael Friedrich <michael.friedrich@icinga.com>
Tue, 23 Oct 2018 16:29:53 +0000 (18:29 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 19 Jun 2019 12:46:11 +0000 (14:46 +0200)
lib/remote/apilistener-filesync.cpp

index e4ed1f3106f85c00d3f29713bc53fe9cf56888c8..b382ffed3251bb2f271a673fef30bf61754f1dac 100644 (file)
@@ -132,23 +132,24 @@ bool ApiListener::UpdateConfigDir(const ConfigDirInformation& oldConfigInfo, con
                }
        }
 
-       /* Update with staging information TODO - use `authoritative` as flag. */
+       /* Log something whether we're authoritative or receing a staged config. */
        Log(LogInformation, "ApiListener")
-               << "Applying configuration file update for path '" << configDir << "' (" << numBytes << " Bytes). Received timestamp '"
+               << "Applying configuration file update for " << (authoritative ? "" : "stage ")
+               << "path '" << configDir << "' (" << numBytes << " Bytes). Received timestamp '"
                << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", newTimestamp) << "' ("
                << std::fixed << std::setprecision(6) << newTimestamp
                << "), Current timestamp '"
                << Utility::FormatDateTime("%Y-%m-%d %H:%M:%S %z", oldTimestamp) << "' ("
                << oldTimestamp << ").";
 
-       /* TODO: Deal with recursive directories. */
+       /* If the update removes a path, delete it on disk. */
        ObjectLock xlock(oldConfig);
        for (const Dictionary::Pair& kv : oldConfig) {
                if (!newConfig->Contains(kv.first)) {
                        configChange = true;
 
                        String path = configDir + "/" + kv.first;
-                       (void) unlink(path.CStr());
+                       Utility::RemoveDirRecursive(path);
                }
        }