Skip to content
Snippets Groups Projects
Commit 6134be2e authored by Daniel Salzman's avatar Daniel Salzman
Browse files

Merge branch 'fix_difse_zij_master' into 'master'

load: fix storing zone-in-journal with difference-no-serial

See merge request !1273
parents 999e2d71 989c95f0
No related branches found
No related tags found
1 merge request!1273load: fix storing zone-in-journal with difference-no-serial
Pipeline #78411 passed
......@@ -156,11 +156,14 @@ int event_load(conf_t *conf, zone_t *zone)
// If configured contents=all, but not present, store zonefile.
if ((load_from == JOURNAL_CONTENT_ALL || zone->cat_members != NULL) &&
!zone_in_journal_exists && zf_conts != NULL) {
ret = zone_in_journal_store(conf, zone, zf_conts);
!zone_in_journal_exists && (zf_conts != NULL || old_contents_exist)) {
zone_contents_t *store_c = old_contents_exist ? zone->contents : zf_conts;
ret = zone_in_journal_store(conf, zone, store_c);
if (ret != KNOT_EOK) {
log_zone_warning(zone->name, "failed to write zone-in-journal (%s)",
knot_strerror(ret));
} else {
zone_in_journal_exists = true;
}
}
......
$ORIGIN example.
$TTL 1200
@ SOA ns admin 1 25 25 80 600
NS ns
ns AAAA ::0
$ORIGIN example.
$TTL 1200
@ SOA ns admin 1 25 25 80 600
NS ns
ns AAAA ::0
added A 1.2.3.4
#!/usr/bin/env python3
"""
Test of difference-no-serial with changing journal-content.
"""
from dnstest.utils import *
from dnstest.test import Test
import random
t = Test()
# radnomized different test scenarios
purge_beforehand = random.choice([True, False])
cold_reload = random.choice([True, False])
zone_reload_afterwards = random.choice([True, False])
detail_log("Scenario: purge_beforehand %s, cold_reload %s, zone_reload_afterwards %s" % (str(purge_beforehand), str(cold_reload), str(zone_reload_afterwards)))
knot = t.server("knot")
zone = t.zone("example.", storage=".")
t.link(zone, knot)
knot.dnssec(zone).enable = True
knot.zonefile_sync = "-1"
t.start()
serial = knot.zone_wait(zone)
knot.zones[zone[0].name].journal_content = "all"
knot.zonefile_load = "difference-no-serial"
if purge_beforehand:
knot.ctl("zone-purge -f +expire example.")
knot.gen_confile()
if cold_reload:
knot.stop()
t.sleep(2)
knot.start()
knot.zone_wait(zone)
else:
knot.reload()
t.sleep(5)
if zone_reload_afterwards:
knot.ctl("zone-reload")
t.sleep(3)
knot.update_zonefile(zone, version=1)
knot.ctl("zone-reload")
knot.zone_wait(zone, serial)
t.end()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment