]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Merge weight log to status log
authorn0tlu5 <darfisultoni@gmail.com>
Thu, 23 May 2024 01:38:11 +0000 (08:38 +0700)
committern0tlu5 <darfisultoni@gmail.com>
Thu, 23 May 2024 01:38:11 +0000 (08:38 +0700)
pdns/lua-record.cc

index 8d3e5ae0cd862ba6fad80a12b3dce9b0a0d70bb8..a5970a7d0f337180b70739bcaa98805f796da1e0 100644 (file)
@@ -128,10 +128,18 @@ private:
         throw std::runtime_error(boost::str(boost::format("unable to match content with `%s`") % cd.opts.at("stringmatch")));
       }
 
-      if(!status) {
-        g_log<<Logger::Info<<"LUA record monitoring declaring "<<remstring<<" UP for URL "<<cd.url<<"!"<<" with WEIGHT "<<content<<"!"<<endl;
+      try {
+        stoi(content);
+        if(!status) {
+          g_log<<Logger::Info<<"LUA record monitoring declaring "<<remstring<<" UP for URL "<<cd.url<<"!"<<" with WEIGHT "<<content<<"!"<<endl;
+        }
       }
-      
+      catch (const std::exception&) {
+        if(!status) {
+          g_log<<Logger::Info<<"LUA record monitoring declaring "<<remstring<<" UP for URL "<<cd.url<<"!"<<endl;
+        }
+      }
+
       setWeight(cd, content);
       setUp(cd);
     }