From: Pieter Lexis Date: Tue, 21 Jul 2015 10:04:26 +0000 (+0200) Subject: pdnssec check-all-zones: allow exit on first error X-Git-Tag: dnsdist-1.0.0-alpha1~248^2~62^2~22^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6ddb28a837ce71dbb919fd9cc132055a7b70ffa;p=thirdparty%2Fpdns.git pdnssec check-all-zones: allow exit on first error Closes #518. Furthermore, `pdnssec check-zone` and `pdnssec check-all-zones` now exits with 1 when one or more errors have been found and 0 when the/all zone(s) are OK. --- diff --git a/pdns/pdnssec.cc b/pdns/pdnssec.cc index b619701a46..53013ab20a 100644 --- a/pdns/pdnssec.cc +++ b/pdns/pdnssec.cc @@ -626,22 +626,29 @@ int checkZone(DNSSECKeeper &dk, UeberBackend &B, const DNSName& zone) } cout<<"Checked "< domainInfo; B.getAllDomains(&domainInfo, true); int errors=0; - BOOST_FOREACH(DomainInfo di, domainInfo) { - if (checkZone(dk, B, di.zone) > 0) - errors++; + for(auto di : domainInfo) { + if (checkZone(dk, B, di.zone) > 0) { + errors++; + if(exitOnError) + return 1; + } } cout<<"Checked "< 1 ? cmds[1] : ""); } else if (cmds[0] == "check-all-zones") { - exit(checkAllZones(dk)); + bool exitOnError = (cmds[1] == "exit-on-error"); + exit(checkAllZones(dk, exitOnError)); } else if (cmds[0] == "list-all-zones") { if (cmds.size() > 2) {