* The ``add-record``, ``delete-rrset``, ``edit-zone``, ``increase-serial`` and
``replace-rrset`` operations will now refuse to work on secondary zones unless
the ``--force`` option is passed.
+* When a zone gets created with either ``create-zone``,
+ ``create-secondary-zone`` or ``load-zone`` (if the zone wasn't existing
+ already), a :ref:`metadata-soa-edit-api` metadata with a value of ``DEFAULT``
+ will be added to the zone.
4.8.0 to 4.9.0
--------------
return EXIT_FAILURE;
}
+// Wrapper around UeberBackend::createDomain, which will also set up the
+// default metadata, matching the behaviour of the REST API.
+static bool createZoneWithDefaults(UtilBackend &backend, DomainInfo &info, const ZoneName& zone, DomainInfo::DomainKind kind, const vector<ComboAddress>& primaries)
+{
+ backend.createDomain(zone, kind, primaries, "");
+ if (!backend.getDomainInfo(zone, info)) {
+ cerr << "Zone '" << zone << "' was not created." << endl;
+ return false;
+ }
+ info.backend->startTransaction(zone, static_cast<int>(info.id));
+ info.backend->setDomainMetadataOne(zone, "SOA-EDIT-API", "DEFAULT");
+ info.backend->commitTransaction();
+ return true;
+}
+
static int loadZone(const ZoneName& zone, const string& fname) {
UtilBackend B; //NOLINT(readability-identifier-length)
DomainInfo di;
return EXIT_FAILURE;
}
cerr<<"Creating '"<<zone<<"'"<<endl;
- B.createDomain(zone, DomainInfo::Native, vector<ComboAddress>(), "");
-
- if(!B.getDomainInfo(zone, di)) {
- cerr << "Zone '" << zone << "' was not created." << endl;
+ if (!createZoneWithDefaults(B, di, zone, DomainInfo::Native, vector<ComboAddress>())) {
return EXIT_FAILURE;
}
}
rr.content = makeSOAContent(sd)->getZoneRepresentation(true);
cerr<<"Creating empty zone '"<<zone<<"'"<<endl;
- B.createDomain(zone, DomainInfo::Native, vector<ComboAddress>(), "");
- if(!B.getDomainInfo(zone, di)) {
- cerr << "Zone '" << zone << "' was not created." << endl;
+ if (!createZoneWithDefaults(B, di, zone, DomainInfo::Native, vector<ComboAddress>())) {
return EXIT_FAILURE;
}
primaries.emplace_back(cmds.at(i), 53);
}
cerr << "Creating secondary zone '" << zone << "', with primaries '" << comboAddressVecToString(primaries) << "'" << endl;
- B.createDomain(zone, DomainInfo::Secondary, primaries, "");
- if(!B.getDomainInfo(zone, di)) {
- cerr << "Zone '" << zone << "' was not created." << endl;
+ if (!createZoneWithDefaults(B, di, zone, DomainInfo::Secondary, primaries)) {
+ cerr << "Zone '" << zone << "' was not created!" << endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;