]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do not print recommendations if quiet. 16670/head
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 4 Feb 2026 09:49:56 +0000 (10:49 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Wed, 4 Feb 2026 09:55:58 +0000 (10:55 +0100)
There are people out there using shell scripts to make nails out of
pdnsutil, do not make pdnsutil output parsing more difficult.

Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
pdns/pdnsutil.cc
regression-tests.nobackend/gsqlite3-corrupted-record/command
regression-tests.nobackend/gsqlite3-corrupted-record/expected_result
regression-tests.nobackend/lmdb-id-generation/expected_result
regression-tests.nobackend/lmdb-metadata-leak/command
regression-tests.nobackend/lmdb-metadata-leak/expected_result
regression-tests/tests/zone-variants/command
regression-tests/tests/zone-variants/expected_result.lmdb

index a60652113690a831247f9469c6fdfac6e40087c7..7457f500712cc752470f6882a44c973b95848b44 100644 (file)
@@ -2645,17 +2645,19 @@ static int createZone(const ZoneName &zone, const DNSName& nsname) {
 
   di.backend->commitTransaction();
 
-  // Zone is not secured yet, suggest applying default-soa-edit rule to the
-  // serial number, if applicable.
-  if (sd.serial == 0) {
-    string edit_kind = ::arg()["default-soa-edit"];
-    if (!edit_kind.empty() && !pdns_iequals(edit_kind, "NONE")) {
-      cout << "Consider invoking 'pdnsutil zone increase-serial " << zone << "'" << endl;
+  if (!g_quiet) {
+    // Zone is not secured yet, suggest applying default-soa-edit rule to the
+    // serial number, if applicable.
+    if (sd.serial == 0) {
+      string edit_kind = ::arg()["default-soa-edit"];
+      if (!edit_kind.empty() && !pdns_iequals(edit_kind, "NONE")) {
+        cout << "Consider invoking 'pdnsutil zone increase-serial " << zone << "'" << endl;
+      }
     }
-  }
 
-  if (::arg().asNum("zone-cache-refresh-interval") != 0) {
-    cout << "If the authoritative server is running, be sure to refresh its zone cache" << endl << "with 'pdns_control rediscover'" << endl;
+    if (::arg().asNum("zone-cache-refresh-interval") != 0) {
+      cout << "If the authoritative server is running, be sure to refresh its zone cache" << endl << "with 'pdns_control rediscover'" << endl;
+    }
   }
 
   return EXIT_SUCCESS;
index 585c0f65711f8fca2c17e63aec0b083977c6687c..5eb60af5cd6ded179b5f872872f2f0da6c5e014c 100755 (executable)
@@ -14,7 +14,7 @@ sqlite3 pdns.sqlite3 < ../modules/gsqlite3backend/schema.sqlite3.sql
 echo ANALYZE\; | sqlite3 pdns.sqlite3
 
 # Create zone
-$PDNSUTIL $ARGS zone create bug.less
+$PDNSUTIL -q $ARGS zone create bug.less
 
 # Add some valid records
 $PDNSUTIL $ARGS rrset add bug.less bug.less NS no.bug.less
index 23ad966072c119562e7c15bf506f20622f87f8b9..343b6d22dbcce82129f8480408002924fb0ecac1 100644 (file)
@@ -1,5 +1,3 @@
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
 New rrset:
 bug.less. 3600 IN NS no.bug.less.
 New rrset:
index d5848e1ab1dfe26e3e10535a9f8132223c778ac0..127b73f5966d6c76e64a219e20f61f0540966e9a 100644 (file)
@@ -1,6 +1,2 @@
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
 sequential generator generated 1 2 3 correctly
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
 random generator generated something other than 1 2 3, good
index c4d9d02c0aff54be43c8a5a72e04a5e738be0bab..0cd7972a2bc8a44af0fe68e1019657fc003097d5 100755 (executable)
@@ -21,7 +21,7 @@ EOF
   echo === random=$random
 
   echo == creating zone
-  $PDNSUTIL --config-dir="${workdir}" --config-name=lmdb create-zone example.com
+  $PDNSUTIL --config-dir="${workdir}" --config-name=lmdb -q create-zone example.com
   
   $PDNSUTIL --config-dir="${workdir}" --config-name=lmdb set-meta example.com FOO BAR
   $PDNSUTIL --config-dir="${workdir}" --config-name=lmdb show-zone example.com | grep FOO
@@ -38,4 +38,4 @@ EOF
   echo == deleting zone
   $PDNSUTIL --config-dir="${workdir}" --config-name=lmdb delete-zone example.com
   mdb_dump -p -a -n ${workdir}/pdns.lmdb | egrep -o 'FOO[0-9]*' | LC_ALL=C sort
-done
\ No newline at end of file
+done
index b9a8736e075b750a851a2669c116002b1505d0dd..d1be72c23396d97be903968e52845e229686ddcb 100644 (file)
@@ -1,10 +1,5 @@
 === random=no
 == creating zone
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
-WARNING: local files have been created as a result of this operation.
-Be sure to check the files owner, group and permission to make sure that
-the authoritative server can correctly use them.
 Set 'example.com' meta FOO = BAR
        FOO     BAR
 FOO
@@ -21,11 +16,6 @@ FOO2
 == deleting zone
 === random=yes
 == creating zone
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
-WARNING: local files have been created as a result of this operation.
-Be sure to check the files owner, group and permission to make sure that
-the authoritative server can correctly use them.
 Set 'example.com' meta FOO = BAR
        FOO     BAR
 FOO
index 570e26d437a77f3375534674ce9147c9420de325..4bd5217b0ce7121396a18555c9ebcff9ae052a14 100755 (executable)
@@ -7,14 +7,14 @@ $PDNSUTIL --config-dir=. --config-name=$backend $* 2>&1 | egrep -v 'destructor'
 
 set -e # to make this first call exit us early for non-variant capable backends. This relies on the existing example.com causing "already exists"
 
-pdnsutil_wrapper create-zone example.com..variant1 | egrep -v 'file|use them'
+pdnsutil_wrapper -q create-zone example.com..variant1
 set +e
 pdnsutil_wrapper show-zone example.com..variant1
 
-pdnsutil_wrapper create-zone ..myroot | egrep -v 'file|use them'
+pdnsutil_wrapper -q create-zone ..myroot
 pdnsutil_wrapper show-zone ..myroot
 
-pdnsutil_wrapper create-zone . | egrep -v 'file|use them'
+pdnsutil_wrapper -q create-zone .
 pdnsutil_wrapper show-zone .
 
 pdnsutil_wrapper list-all-zones | LC_ALL=C sort
index a4fd54aade495170e8b499057b1af171cf0d6a19..9fbb87d32ca0073de003c1da77a8e58a8590ba3e 100644 (file)
@@ -1,6 +1,4 @@
 Creating empty zone 'example.com..variant1'
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
 This is a Native zone
 Variant: variant1
 Zone is not actively secured
@@ -8,8 +6,6 @@ Metadata items:
        SOA-EDIT-API    DEFAULT
 No keys for zone 'example.com..variant1'.
 Creating empty zone '..myroot'
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
 This is a Native zone
 Variant: myroot
 Zone is not actively secured
@@ -17,8 +13,6 @@ Metadata items:
        SOA-EDIT-API    DEFAULT
 No keys for zone '..myroot'.
 Creating empty zone '.'
-If the authoritative server is running, be sure to refresh its zone cache
-with 'pdns_control rediscover'
 This is a Native zone
 Zone is not actively secured
 Metadata items: