Removes zone files when a zone is deleted

Add "-clean" option to "rndc delzone".
Note:
 The "-clean" option will take effect on bind>=9.10.0.

Change-Id: I911e929a6fea1d8c73a7247a8a574abb95335709
Closes-Bug: 1507243
This commit is contained in:
kenichiro matsuda 2015-10-18 11:35:46 +09:00
parent 3c9a7794aa
commit 7618d073c9
2 changed files with 9 additions and 1 deletions

View File

@ -17,6 +17,7 @@ import random
import six
from oslo_log import log as logging
from oslo_utils import strutils
from designate import exceptions
from designate import utils
@ -42,6 +43,11 @@ class Bind9Backend(base.Backend):
self.rndc_config_file = self.options.get('rndc_config_file')
self.rndc_key_file = self.options.get('rndc_key_file')
# Removes zone files when a zone is deleted.
# This option will take effect on bind>=9.10.0.
self.clean_zonefile = strutils.bool_from_string(
self.options.get('clean_zonefile', 'false'))
def create_domain(self, context, domain):
LOG.debug('Create Domain')
masters = []
@ -77,6 +83,8 @@ class Bind9Backend(base.Backend):
'delzone',
'%s' % domain['name'].rstrip('.'),
]
if self.clean_zonefile:
rndc_op.insert(1, '-clean')
try:
self._execute_rndc(rndc_op)

View File

@ -327,7 +327,7 @@ debug = False
#host = 192.168.27.100
#[pool_target:f26e0b32-736f-4f0a-831b-039a415c481e]
#options = rndc_host: 192.168.27.100, rndc_port: 953, rndc_config_file: /etc/bind/rndc.conf, rndc_key_file: /etc/bind/rndc.key, port: 53, host: 192.168.27.100
#options = rndc_host: 192.168.27.100, rndc_port: 953, rndc_config_file: /etc/bind/rndc.conf, rndc_key_file: /etc/bind/rndc.key, port: 53, host: 192.168.27.100, clean_zonefile: false
#masters = 192.168.27.100:5354
#type = bind9