DataSourceClient.get_updater must return None when it cannot find the zone.
Otherwise the returned updater would be incomplete and would subseuqently
cause a disruption (such as program crash).
The RR class of the zone is the one that the client is expected to\n\
handle (see the detailed description of this class).\n\
\n\
-If the specified zone is not found via the client, a NULL pointer will\n\
+If the specified zone is not found via the client, a None object will\n\
be returned; in other words a completely new zone cannot be created\n\
using an updater. It must be created beforehand (even if it's an empty\n\
placeholder) in a way specific to the underlying data source.\n\
PyBool_Check(replace_obj)) {
bool replace = (replace_obj != Py_False);
try {
- return (createZoneUpdaterObject(
- self->cppobj->getUpdater(PyName_ToName(name_obj),
- replace)));
+ ZoneUpdaterPtr updater =
+ self->cppobj->getUpdater(PyName_ToName(name_obj), replace);
+ if (!updater) {
+ return (Py_None);
+ }
+ return (createZoneUpdaterObject(updater));
} catch (const isc::NotImplemented& ne) {
PyErr_SetString(getDataSourceException("NotImplemented"),
ne.what());
self.assertEqual("www.example.com. 3600 IN A 192.0.2.1\n",
rrset.to_text())
+ def test_update_for_no_zone(self):
+ dsc = isc.datasrc.DataSourceClient(WRITE_ZONE_DB_FILE)
+ self.assertEqual(None,
+ dsc.get_updater(isc.dns.Name("notexistent.example"),
+ True))
if __name__ == "__main__":
isc.log.init("bind10")