diff options
author | Martin Kosek <mkosek@redhat.com> | 2013-03-20 15:39:59 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2013-03-29 08:59:45 +0100 |
commit | 48ba165576db93a26d75c50a01ab1be47bb80a69 (patch) | |
tree | 2a7bcd885c50097768f62a6d7b2af5ee46d4169a | |
parent | d8f75e9e0c63dd53e6f777e59949223509ed5ac3 (diff) | |
download | freeipa-48ba165576db93a26d75c50a01ab1be47bb80a69.tar.gz freeipa-48ba165576db93a26d75c50a01ab1be47bb80a69.tar.xz freeipa-48ba165576db93a26d75c50a01ab1be47bb80a69.zip |
Put pid-file to named.conf
Fedora 19 has splitted /var/run and /run directories while in Fedora
18 it used to be a symlink. Thus, named may expect its PID file to be
in other direct than it really is and fail to start.
Add pid-file configuration option to named.conf both for new
installations and for upgraded machines.
-rw-r--r-- | install/share/bind.named.conf.template | 1 | ||||
-rw-r--r-- | install/tools/ipa-upgradeconfig | 45 |
2 files changed, 45 insertions, 1 deletions
diff --git a/install/share/bind.named.conf.template b/install/share/bind.named.conf.template index b12df593a..e4ce60583 100644 --- a/install/share/bind.named.conf.template +++ b/install/share/bind.named.conf.template @@ -15,6 +15,7 @@ options { allow-recursion { any; }; tkey-gssapi-keytab "/etc/named.keytab"; + pid-file "/run/named/named.pid"; }; /* If you want to enable debugging, eg. using the 'rndc trace' command, diff --git a/install/tools/ipa-upgradeconfig b/install/tools/ipa-upgradeconfig index f5652139d..c690544fa 100644 --- a/install/tools/ipa-upgradeconfig +++ b/install/tools/ipa-upgradeconfig @@ -516,6 +516,47 @@ def named_update_gssapi_configuration(): sysupgrade.set_upgrade_state('named.conf', 'gssapi_updated', True) return True +def named_update_pid_file(): + """ + Make sure that named reads the pid file from the right file + """ + root_logger.info('[Updating pid-file configuration in DNS]') + + if not bindinstance.named_conf_exists(): + # DNS service may not be configured + root_logger.info('DNS is not configured') + return False + + if sysupgrade.get_upgrade_state('named.conf', 'pid-file_updated'): + root_logger.debug('Skip pid-file configuration check') + return False + + try: + pid_file = bindinstance.named_conf_get_directive('pid-file', + bindinstance.NAMED_SECTION_OPTIONS) + except IOError, e: + root_logger.error('Cannot retrieve pid-file option from %s: %s', + bindinstance.NAMED_CONF, e) + return False + else: + if pid_file: + root_logger.debug('pid-file configuration already updated') + sysupgrade.set_upgrade_state('named.conf', 'pid-file_updated', True) + return False + + try: + bindinstance.named_conf_set_directive('pid-file', '/run/named/named.pid', + bindinstance.NAMED_SECTION_OPTIONS) + except IOError, e: + root_logger.error('Cannot update pid-file configuration in %s: %s', + bindinstance.NAMED_CONF, e) + return False + else: + root_logger.debug('pid-file configuration updated') + + sysupgrade.set_upgrade_state('named.conf', 'pid-file_updated', True) + return True + def enable_certificate_renewal(ca): """ @@ -808,7 +849,9 @@ def main(): changed_psearch = named_enable_psearch() changed_autoincrement = named_enable_serial_autoincrement() changed_gssapi_conf = named_update_gssapi_configuration() - if changed_psearch or changed_autoincrement or changed_gssapi_conf: + changed_pid_file_conf = named_update_pid_file() + if (changed_psearch or changed_autoincrement or changed_gssapi_conf + or changed_pid_file_conf): # configuration has changed, restart the name server root_logger.info('Changes to named.conf have been made, restart named') bind = bindinstance.BindInstance(fstore) |