From d6ddb28a837ce71dbb919fd9cc132055a7b70ffa Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Tue, 21 Jul 2015 12:04:26 +0200 Subject: [PATCH] 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. --- pdns/pdnssec.cc | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/pdns/pdnssec.cc b/pdns/pdnssec.cc index b619701a4..53013ab20 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) { -- 2.49.0