]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: better error message when reload-yaml fails 16104/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 9 Sep 2025 11:55:21 +0000 (13:55 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 10 Sep 2025 10:02:15 +0000 (12:02 +0200)
Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
pdns/recursordist/rec-rust-lib/cxxsettings.hh
pdns/recursordist/rec-rust-lib/cxxsupport.cc
pdns/recursordist/rec_channel_rec.cc

index 0d65b121de085de2060aac05ff3fab20cdd17b1e..cf4fc318cb6ac0721531dc1b7d899e1fd4ac1008 100644 (file)
@@ -55,5 +55,5 @@ void setArgsForACLRelatedSettings(pdns::rust::settings::rec::Recursorsettings& s
 void fromLuaConfigToBridgeStruct(LuaConfigItems& luaConfig, const ProxyMapping& proxyMapping, pdns::rust::settings::rec::Recursorsettings& settings);
 void fromBridgeStructToLuaConfig(const pdns::rust::settings::rec::Recursorsettings& settings, LuaConfigItems& luaConfig, ProxyMapping& proxyMapping);
 bool luaItemSet(const pdns::rust::settings::rec::Recursorsettings& settings);
-YamlSettingsStatus tryReadYAML(const string& yamlconfigname, bool setGlobals, bool& yamlSettings, bool& luaSettingsInYAML, rust::settings::rec::Recursorsettings& settings, Logr::log_t startupLog);
+YamlSettingsStatus tryReadYAML(const string& yamlconfigname, bool setGlobals, bool& yamlSettings, bool& luaSettingsInYAML, rust::settings::rec::Recursorsettings& settings, Logr::log_t startupLog, Logr::Priority level = Logr::Debug);
 }
index 31ec15dc0859955807504424eb7d259777d70efb..0c0d1b38bc7c48534e07f398d1faaba3ec56d2f4 100644 (file)
@@ -1398,7 +1398,7 @@ bool pdns::settings::rec::luaItemSet(const pdns::rust::settings::rec::Recursorse
   return !alldefault;
 }
 
-pdns::settings::rec::YamlSettingsStatus pdns::settings::rec::tryReadYAML(const string& yamlconfigname, bool setGlobals, bool& yamlSettings, bool& luaSettingsInYAML, rust::settings::rec::Recursorsettings& settings, Logr::log_t startupLog)
+pdns::settings::rec::YamlSettingsStatus pdns::settings::rec::tryReadYAML(const string& yamlconfigname, bool setGlobals, bool& yamlSettings, bool& luaSettingsInYAML, rust::settings::rec::Recursorsettings& settings, Logr::log_t startupLog, Logr::Priority level)
 {
   string msg;
   // TODO: handle include-dir on command line
@@ -1406,7 +1406,7 @@ pdns::settings::rec::YamlSettingsStatus pdns::settings::rec::tryReadYAML(const s
 
   switch (yamlstatus) {
   case pdns::settings::rec::YamlSettingsStatus::CannotOpen:
-    startupLog->error(Logr::Debug, msg, "No YAML config found", "configname", Logging::Loggable(yamlconfigname));
+    startupLog->error(level, msg, "No YAML config found", "configname", Logging::Loggable(yamlconfigname));
     break;
 
   case pdns::settings::rec::YamlSettingsStatus::PresentButFailed:
index 0289388fad52d9637ac826b668119b8c0b3a08f7..d0440509288f367fa5afbdf9ef176fc225e236d5 100644 (file)
@@ -1989,9 +1989,9 @@ RecursorControlChannel::Answer luaconfig(bool broadcast)
     bool dummy1{};
     bool dummy2{};
     pdns::rust::settings::rec::Recursorsettings settings;
-    auto yamlstat = pdns::settings::rec::tryReadYAML(configname + g_yamlSettingsSuffix, false, dummy1, dummy2, settings, g_slog);
+    auto yamlstat = pdns::settings::rec::tryReadYAML(configname + g_yamlSettingsSuffix, false, dummy1, dummy2, settings, g_slog, Logr::Error);
     if (yamlstat != pdns::settings::rec::YamlSettingsStatus::OK) {
-      return {1, "Not reloading dynamic part of YAML configuration\n"};
+      return {1, "Reloading dynamic part of YAML configuration failed\n"};
     }
     auto generation = g_luaconfs.getLocal()->generation;
     lci.generation = generation + 1;