From: Miod Vallat Date: Wed, 4 Feb 2026 09:49:56 +0000 (+0100) Subject: Do not print recommendations if quiet. X-Git-Tag: rec-5.5.0-alpha0~20^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16670%2Fhead;p=thirdparty%2Fpdns.git Do not print recommendations if quiet. 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 --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index a606521136..7457f50071 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -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; diff --git a/regression-tests.nobackend/gsqlite3-corrupted-record/command b/regression-tests.nobackend/gsqlite3-corrupted-record/command index 585c0f6571..5eb60af5cd 100755 --- a/regression-tests.nobackend/gsqlite3-corrupted-record/command +++ b/regression-tests.nobackend/gsqlite3-corrupted-record/command @@ -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 diff --git a/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result b/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result index 23ad966072..343b6d22db 100644 --- a/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result +++ b/regression-tests.nobackend/gsqlite3-corrupted-record/expected_result @@ -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: diff --git a/regression-tests.nobackend/lmdb-id-generation/expected_result b/regression-tests.nobackend/lmdb-id-generation/expected_result index d5848e1ab1..127b73f596 100644 --- a/regression-tests.nobackend/lmdb-id-generation/expected_result +++ b/regression-tests.nobackend/lmdb-id-generation/expected_result @@ -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 diff --git a/regression-tests.nobackend/lmdb-metadata-leak/command b/regression-tests.nobackend/lmdb-metadata-leak/command index c4d9d02c0a..0cd7972a2b 100755 --- a/regression-tests.nobackend/lmdb-metadata-leak/command +++ b/regression-tests.nobackend/lmdb-metadata-leak/command @@ -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 diff --git a/regression-tests.nobackend/lmdb-metadata-leak/expected_result b/regression-tests.nobackend/lmdb-metadata-leak/expected_result index b9a8736e07..d1be72c233 100644 --- a/regression-tests.nobackend/lmdb-metadata-leak/expected_result +++ b/regression-tests.nobackend/lmdb-metadata-leak/expected_result @@ -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 diff --git a/regression-tests/tests/zone-variants/command b/regression-tests/tests/zone-variants/command index 570e26d437..4bd5217b0c 100755 --- a/regression-tests/tests/zone-variants/command +++ b/regression-tests/tests/zone-variants/command @@ -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 diff --git a/regression-tests/tests/zone-variants/expected_result.lmdb b/regression-tests/tests/zone-variants/expected_result.lmdb index a4fd54aade..9fbb87d32c 100644 --- a/regression-tests/tests/zone-variants/expected_result.lmdb +++ b/regression-tests/tests/zone-variants/expected_result.lmdb @@ -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: