Fix NO_DOMAIN handling with The Big Rename

Some various renamings of the "NO_DOMAIN" concept broke the very delicate
handling of a target which doesn't have a zone that it should. This
fixes it.

Change-Id: I86e537fb2b86196528821f15f1e12291be52ce33
Closes-Bug: 1522480
This commit is contained in:
Tim Simmons 2015-12-03 11:34:54 -06:00
parent 3994704dfc
commit 5333caa09c
4 changed files with 7 additions and 7 deletions

View File

@ -2368,7 +2368,7 @@ class Service(service.RPCService, service.Service):
and (serial >= zone_or_record.serial or serial == 0):
zone_or_record.status = 'ERROR'
elif status == 'NO_zone':
elif status == 'NO_ZONE':
if zone_or_record.action in ['CREATE', 'UPDATE']:
zone_or_record.action = 'CREATE'
zone_or_record.status = 'ERROR'

View File

@ -118,7 +118,7 @@ class NotifyEndpoint(base.BaseEndpoint):
zone, host, port, timeout, retry_interval, retries)
if response and response.rcode() in (
dns.rcode.NXDOMAIN, dns.rcode.REFUSED, dns.rcode.SERVFAIL):
status = 'NO_DOMAIN'
status = 'NO_ZONE'
elif response and len(response.answer) == 1 \
and str(response.answer[0].name) == str(zone.name) \
and response.answer[0].rdclass == dns.rdataclass.IN \

View File

@ -42,7 +42,7 @@ CONF = cfg.CONF
SUCCESS_STATUS = 'SUCCESS'
ERROR_STATUS = 'ERROR'
NO_DOMAIN_STATUS = 'NO_DOMAIN'
NO_ZONE_STATUS = 'NO_ZONE'
CREATE_ACTION = 'CREATE'
DELETE_ACTION = 'DELETE'
UPDATE_ACTION = 'UPDATE'
@ -519,11 +519,11 @@ class Service(service.RPCService, coordination.CoordinationMixin,
self.central_api.update_status(
context, zone.id, ERROR_STATUS, error_serial)
if status == NO_DOMAIN_STATUS and action != DELETE_ACTION:
if status == NO_ZONE_STATUS and action != DELETE_ACTION:
LOG.warn(_LW('Zone %(zone)s is not present in some '
'targets') % {'zone': zone.name})
self.central_api.update_status(
context, zone.id, NO_DOMAIN_STATUS, 0)
context, zone.id, NO_ZONE_STATUS, 0)
if consensus_serial == zone.serial and self._is_consensus(
context, zone, action, SUCCESS_STATUS,
@ -659,7 +659,7 @@ class Service(service.RPCService, coordination.CoordinationMixin,
pool_manager_status = self._build_status_object(
nameserver, zone, action)
if status == NO_DOMAIN_STATUS:
if status == NO_ZONE_STATUS:
if action == CREATE_ACTION:
pool_manager_status.status = 'ERROR'
elif action == DELETE_ACTION:

View File

@ -1916,7 +1916,7 @@ class CentralStatusTests(CentralBasic):
serial=0,
)
dom, deleted = self.service.\
_update_zone_or_record_status(zone, 'NO_zone', 0)
_update_zone_or_record_status(zone, 'NO_ZONE', 0)
self.assertEqual(dom.action, 'CREATE')
self.assertEqual(dom.status, 'ERROR')