Skip to content

Commit 92cef2d

Browse files
committed
pdns_control make it posible to notify all zones at once
1 parent fa52e02 commit 92cef2d

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

pdns/dynhandler.cc

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,35 @@ string DLNotifyHostHandler(const vector<string>&parts, Utility::pid_t ppid)
266266
string DLNotifyHandler(const vector<string>&parts, Utility::pid_t ppid)
267267
{
268268
extern CommunicatorClass Communicator;
269-
ostringstream os;
269+
UeberBackend B;
270270
if(parts.size()!=2)
271271
return "syntax: notify domain";
272272
if(!::arg().mustDo("master"))
273273
return "PowerDNS not configured as master";
274274
L<<Logger::Warning<<"Notification request for domain '"<<parts[1]<<"' received from operator"<<endl;
275-
if(!Communicator.notifyDomain(parts[1]))
276-
return "Failed to add to the queue - see log";
277-
return "Added to queue";
275+
276+
if (parts[1] == "*") {
277+
vector<DomainInfo> domains;
278+
B.getAllDomains(&domains);
279+
280+
int total = 0;
281+
int notified = 0;
282+
for (vector<DomainInfo>::const_iterator di=domains.begin(); di != domains.end(); di++) {
283+
if (di->kind == 0) { // MASTER
284+
total++;
285+
if(Communicator.notifyDomain(di->zone))
286+
notified++;
287+
}
288+
}
289+
290+
if (total != notified)
291+
return itoa(notified)+" out of "+itoa(total)+" zones added to queue - see log";
292+
return "Added "+itoa(total)+" MASTER zones to queue";
293+
} else {
294+
if(!Communicator.notifyDomain(parts[1]))
295+
return "Failed to add to the queue - see log";
296+
return "Added to queue";
297+
}
278298
}
279299

280300
string DLRediscoverHandler(const vector<string>&parts, Utility::pid_t ppid)

0 commit comments

Comments
 (0)