Skip to content

Commit

Permalink
Backport PowerDNS#6559
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterlexis committed May 23, 2018
2 parents 951a1d6 + d3ad565 commit e6af9e9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pdns/pdnsutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3110,12 +3110,14 @@ try
// iterate zones
for(const DomainInfo& di: domains) {
size_t nr,nc,nm,nk;
DomainInfo di_new;
DNSResourceRecord rr;
cout<<"Processing '"<<di.zone<<"'"<<endl;
// create zone
if (!tgt->createDomain(di.zone)) throw PDNSException("Failed to create zone");
tgt->setKind(di.zone, di.kind);
tgt->setAccount(di.zone,di.account);
if (!tgt->getDomainInfo(di.zone, di_new)) throw PDNSException("Failed to create zone");
tgt->setKind(di_new.zone, di.kind);
tgt->setAccount(di_new.zone,di.account);
string masters="";
bool first = true;
for(const string& master: di.masters) {
Expand All @@ -3124,11 +3126,12 @@ try
first = false;
masters += master;
}
tgt->setMaster(di.zone, masters);
tgt->setMaster(di_new.zone, masters);
// move records
if (!src->list(di.zone, di.id, true)) throw PDNSException("Failed to list records");
nr=0;
while(src->get(rr)) {
rr.domain_id = di_new.id;
if (!tgt->feedRecord(rr, DNSName())) throw PDNSException("Failed to feed record");
nr++;
}
Expand All @@ -3137,6 +3140,7 @@ try
if (src->listComments(di.id)) {
Comment c;
while(src->getComment(c)) {
c.domain_id = di_new.id;
tgt->feedComment(c);
nc++;
}
Expand Down

0 comments on commit e6af9e9

Please sign in to comment.