From: Aki Tuomi Date: Tue, 1 May 2018 18:46:55 +0000 (+0300) Subject: pdnsutil: Use new domain in b2bmigrate X-Git-Tag: dnsdist-1.3.1~117^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F6559%2Fhead;p=thirdparty%2Fpdns.git pdnsutil: Use new domain in b2bmigrate --- diff --git a/pdns/pdnsutil.cc b/pdns/pdnsutil.cc index 7963a30cc6..59f5955b0a 100644 --- a/pdns/pdnsutil.cc +++ b/pdns/pdnsutil.cc @@ -3099,12 +3099,14 @@ try // iterate zones for(const DomainInfo& di: domains) { size_t nr,nc,nm,nk; + DomainInfo di_new; DNSResourceRecord rr; cout<<"Processing '"<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 auto& master: di.masters) { @@ -3113,11 +3115,12 @@ try first = false; masters += master.toStringWithPortExcept(53); } - 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++; } @@ -3126,6 +3129,7 @@ try if (src->listComments(di.id)) { Comment c; while(src->getComment(c)) { + c.domain_id = di_new.id; tgt->feedComment(c); nc++; }