From 351570f1466e7fa1933ab828dc2503c6d4c403fe Mon Sep 17 00:00:00 2001 From: Endre Karlson Date: Wed, 10 Jun 2015 12:33:30 +0200 Subject: [PATCH] Reset check_for_tlds after deleting the last TLD Closes-Bug: #1463769 Change-Id: I6db240b707eeff38375039793a8444050be5ff97 --- designate/central/service.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/designate/central/service.py b/designate/central/service.py index 8d263db07..a765e93cc 100644 --- a/designate/central/service.py +++ b/designate/central/service.py @@ -683,15 +683,15 @@ class Service(service.RPCService, service.Service): @notification('dns.tld.delete') @transaction def delete_tld(self, context, tld_id): - # Known issue - self.check_for_tld is not reset here. So if the last - # TLD happens to be deleted, then we would incorrectly do the TLD - # validations. - # This decision was influenced by weighing the (ultra low) probability - # of hitting this issue vs doing the checks for every delete. policy.check('delete_tld', context, {'tld_id': tld_id}) tld = self.storage.delete_tld(context, tld_id) + # We need to ensure that if there's no more TLD's we'll not break + # domain creation. + if not self.storage.find_tlds(context, limit=1): + self.check_for_tlds = False + return tld # TSIG Key Methods