Reset check_for_tlds after deleting the last TLD

Closes-Bug: #1463769

Change-Id: I6db240b707eeff38375039793a8444050be5ff97
This commit is contained in:
Endre Karlson 2015-06-10 12:33:30 +02:00 committed by Kiall Mac Innes
parent 29adef5e12
commit 351570f146

View File

@ -683,15 +683,15 @@ class Service(service.RPCService, service.Service):
@notification('dns.tld.delete') @notification('dns.tld.delete')
@transaction @transaction
def delete_tld(self, context, tld_id): 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}) policy.check('delete_tld', context, {'tld_id': tld_id})
tld = self.storage.delete_tld(context, 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 return tld
# TSIG Key Methods # TSIG Key Methods