sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #06179
[Merge] ~cgrabowski/maas:backport_fix_missing_dns_records_to_3.3 into maas:3.3
Christian Grabowski has proposed merging ~cgrabowski/maas:backport_fix_missing_dns_records_to_3.3 into maas:3.3.
Commit message:
ensure needsDNSUpdate is true when there were queued updates
(cherry picked from commit 229f33899ba06b9067067b63b5c72689ab7a44e0)
Requested reviews:
Christian Grabowski (cgrabowski)
For more details, see:
https://code.launchpad.net/~cgrabowski/maas/+git/maas/+merge/439185
--
Your team MAAS Committers is subscribed to branch maas:3.3.
diff --git a/src/maasserver/region_controller.py b/src/maasserver/region_controller.py
index a8cb828..de5e1e8 100644
--- a/src/maasserver/region_controller.py
+++ b/src/maasserver/region_controller.py
@@ -225,6 +225,7 @@ class RegionControllerService(Service):
if len(self._queued_updates) > 0:
self._dns_updates = self._queued_updates
self._queued_updates = []
+ self.needsDNSUpdate = True
else:
self._dns_updates = []
self._dns_requires_full_reload = False
diff --git a/src/maasserver/tests/test_region_controller.py b/src/maasserver/tests/test_region_controller.py
index 072d3b3..e5a1f09 100644
--- a/src/maasserver/tests/test_region_controller.py
+++ b/src/maasserver/tests/test_region_controller.py
@@ -893,3 +893,57 @@ class TestRegionControllerServiceTransactional(MAASTransactionServerTestCase):
],
)
self.assertCountEqual(service._queued_updates, [])
+
+ @wait_for_reactor
+ @inlineCallbacks
+ def test_dns_is_set_to_update_when_queued_updates_are_present(self):
+ domain = yield deferToDatabase(factory.make_Domain)
+ update_result = (random.randint(0, 10), True, [domain.name])
+ record = yield deferToDatabase(factory.make_DNSResource, domain=domain)
+ service = RegionControllerService(sentinel.listener)
+
+ update_zones = self.patch(region_controller, "dns_update_all_zones")
+ update_zones.return_value = update_result
+ check_serial = self.patch(service, "_checkSerial")
+ check_serial.return_value = succeed(update_result)
+
+ service._dns_update_in_progress = True
+ service.queueDynamicDNSUpdate(
+ factory.make_name(),
+ f"INSERT {domain.name} {record.name} A 30 10.10.10.10",
+ )
+ self.assertCountEqual(service._dns_updates, [])
+ expected_updates = [
+ DynamicDNSUpdate(
+ operation="INSERT",
+ name=f"{record.name}.{domain.name}",
+ zone=domain.name,
+ rectype="A",
+ ttl=30,
+ answer="10.10.10.10",
+ )
+ ]
+ self.assertCountEqual(
+ service._queued_updates,
+ expected_updates,
+ )
+ service.needsDNSUpdate = True
+
+ # 3 times, first to queue the update, second to process the update,
+ # third to ensure it doesn't flag for update without updates queued
+ for i in range(3):
+ if i == 2:
+ # should fail on assert that the loop is running when stopping
+ try:
+ yield service.process()
+ except AssertionError:
+ pass
+ else:
+ yield service.process()
+
+ update_zones.assert_has_calls(
+ [
+ call(dynamic_updates=[], requires_reload=True),
+ call(dynamic_updates=expected_updates, requires_reload=False),
+ ]
+ )
References