Permalink
Browse files

pdns_control make it posible to notify all zones at once

  • Loading branch information...
1 parent fa52e02 commit 92cef2d6f44c4d36c66c916ee7691fb9aee896ac @mind04 mind04 committed with mind04 Dec 30, 2014
Showing with 24 additions and 4 deletions.
  1. +24 −4 pdns/dynhandler.cc
View
@@ -266,15 +266,35 @@ string DLNotifyHostHandler(const vector<string>&parts, Utility::pid_t ppid)
string DLNotifyHandler(const vector<string>&parts, Utility::pid_t ppid)
{
extern CommunicatorClass Communicator;
- ostringstream os;
+ UeberBackend B;
if(parts.size()!=2)
return "syntax: notify domain";
if(!::arg().mustDo("master"))
return "PowerDNS not configured as master";
L<<Logger::Warning<<"Notification request for domain '"<<parts[1]<<"' received from operator"<<endl;
- if(!Communicator.notifyDomain(parts[1]))
- return "Failed to add to the queue - see log";
- return "Added to queue";
+
+ if (parts[1] == "*") {
+ vector<DomainInfo> domains;
+ B.getAllDomains(&domains);
+
+ int total = 0;
+ int notified = 0;
+ for (vector<DomainInfo>::const_iterator di=domains.begin(); di != domains.end(); di++) {
+ if (di->kind == 0) { // MASTER
+ total++;
+ if(Communicator.notifyDomain(di->zone))
+ notified++;
+ }
+ }
+
+ if (total != notified)
+ return itoa(notified)+" out of "+itoa(total)+" zones added to queue - see log";
+ return "Added "+itoa(total)+" MASTER zones to queue";
+ } else {
+ if(!Communicator.notifyDomain(parts[1]))
+ return "Failed to add to the queue - see log";
+ return "Added to queue";
+ }
}
string DLRediscoverHandler(const vector<string>&parts, Utility::pid_t ppid)

0 comments on commit 92cef2d

Please sign in to comment.