From 22cbba41698038c0d4837ff6667a701ebf7ba2a8 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Thu, 10 Aug 2017 13:27:23 +0200 Subject: [PATCH] Defining and configuring different commands --- pp_lib/config_named_app.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/pp_lib/config_named_app.py b/pp_lib/config_named_app.py index ef8dfc1..120d2cf 100644 --- a/pp_lib/config_named_app.py +++ b/pp_lib/config_named_app.py @@ -42,7 +42,7 @@ from .cfg_app import PpCfgAppError, PpConfigApplication from .pidfile import PidFileError, InvalidPidFileError, PidFileInUseError, PidFile -__version__ = '0.6.6' +__version__ = '0.7.1' LOG = logging.getLogger(__name__) @@ -91,6 +91,12 @@ class PpConfigNamedApp(PpConfigApplication): '217.66.53.86', ] + default_cmd_checkconf = '/usr/sbin/named-checkconf' + default_cmd_reload = '/usr/sbin/rndc reload' + default_cmd_status = '/usr/bin/systemctl status named.service' + default_cmd_start = '/usr/bin/systemctl start named.service' + default_cmd_restart = '/usr/bin/systemctl restart named.service' + re_split_addresses = re.compile(r'[,;\s]+') re_integer = re.compile(r'^\s*(\d+)\s*$') @@ -290,6 +296,12 @@ class PpConfigNamedApp(PpConfigApplication): self.reload_necessary = False self.restart_necessary = False + self.cmd_checkconf = self.default_cmd_checkconf + self.cmd_reload = self.default_cmd_reload + self.cmd_status = self.default_cmd_status + self.cmd_start = self.default_cmd_start + self.cmd_restart = self.default_cmd_restart + self.files2replace = {} self.moved_files = {} @@ -493,6 +505,11 @@ class PpConfigNamedApp(PpConfigApplication): res['default_named_log_dir'] = self.default_named_log_dir res['default_named_version2show'] = self.default_named_version2show res['default_zone_masters'] = copy.copy(self.default_zone_masters) + res['default_cmd_checkconf'] = copy.copy(self.default_cmd_checkconf) + res['default_cmd_reload'] = copy.copy(self.default_cmd_reload) + res['default_cmd_start'] = copy.copy(self.default_cmd_start) + res['default_cmd_status'] = copy.copy(self.default_cmd_status) + res['default_cmd_restart'] = copy.copy(self.default_cmd_restart) res['re_split_addresses'] = self.re_split_addresses res['re_integer'] = self.re_integer res['re_ipv4_zone'] = self.re_ipv4_zone @@ -685,6 +702,10 @@ class PpConfigNamedApp(PpConfigApplication): if 'masters' in section: self._get_masters_from_cfg(section['masters'], section_name) + for item in ('cmd_checkconf', 'cmd_reload', 'cmd_status', 'cmd_start', 'cmd_restart'): + if item in section and section[item].strip(): + setattr(self, item, section[item].strip()) + # ------------------------------------------------------------------------- def _check_path_config(self, section, section_name, key, class_prop, absolute=True, desc=None): -- 2.39.5