from .pidfile import PidFileError, InvalidPidFileError, PidFileInUseError, PidFile
-__version__ = '0.5.5'
+__version__ = '0.5.6'
LOG = logging.getLogger(__name__)
self.exit(8)
elif not os.path.isfile(self.rndc_config_file):
LOG.error("File {!r} is not a regular file.".format(self.rndc_config_file))
- self.exit(8)
+ if not self.simulate:
+ self.exit(8)
content += '\n// Managed Keys of RNDC\n'
content += 'include "{}";\n'.format(self.rndc_config_file)
content += '\ncontrols {\n'
content += '\n// logging configuration\n'
content += 'include "{}";\n'.format(self.named_log_cfg_file)
+ # Defining root zone file
+ if not os.path.exists(self.named_root_zone_file_abs):
+ LOG.error("File {!r} does not exists.".format(self.named_root_zone_file_abs))
+ if not self.simulate:
+ self.exit(8)
+ elif not os.path.isfile(self.named_root_zone_file_abs):
+ LOG.error("File {!r} is not a regular file.".format(self.named_root_zone_file_abs))
+ if not self.simulate:
+ self.exit(8)
+ fname = self.named_root_zone_file_rel
+ if os.path.isabs(fname):
+ fname_rel = os.path.relpath(fname, self.named_basedir)
+ if not fname_rel.startswith('../'):
+ fname = fname_rel
+ content += '\nzone "." {\n'
+ content += '\ttype hint;\n'
+ content += '\tfile "{}";\n'.format(fname)
+ content += '};\n'
+
+ # Including zone definitions for default zones
+ if not os.path.exists(self.named_def_zones_file):
+ LOG.error("File {!r} does not exists.".format(self.named_def_zones_file))
+ if not self.simulate:
+ self.exit(8)
+ elif not os.path.isfile(self.named_def_zones_file):
+ LOG.error("File {!r} is not a regular file.".format(self.named_def_zones_file))
+ if not self.simulate:
+ self.exit(8)
+ content += '\n// Default zones per RFC 1912\n'
+ content += 'include "{}";\n'.format(self.named_def_zones_file)
+
+ # Including root keys for DNSSEC
+ if not os.path.exists(self.named_rootkeys_file):
+ LOG.error("File {!r} does not exists.".format(self.named_rootkeys_file))
+ if not self.simulate:
+ self.exit(8)
+ elif not os.path.isfile(self.named_rootkeys_file):
+ LOG.error("File {!r} is not a regular file.".format(self.named_rootkeys_file))
+ if not self.simulate:
+ self.exit(8)
+ content += '\n// Including root keys for DNSSEC\n'
+ content += 'include "{}";\n'.format(self.named_rootkeys_file)
+
+ content += '\n// Including definitions of all slave zones\n'
+ content += 'include "{}";\n'.format(self.named_zones_cfg_file)
+
content += '\n// vim: ts=8 filetype=named noet noai\n'
with open(self.temp_named_conf, 'w', **self.open_args) as fh: