diff options
author | Martin Kosek <mkosek@redhat.com> | 2012-10-18 16:50:08 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-10-18 20:53:51 -0400 |
commit | 5f95fbfad2729e59d67730d2d476befa4e0a2e02 (patch) | |
tree | c7203063319952d634fcbac1a19da1f9c41e1b3e /ipapython | |
parent | e65f51142cdefc470711dfaf0ce4e5cdc96c6a36 (diff) | |
download | freeipa.git-5f95fbfad2729e59d67730d2d476befa4e0a2e02.tar.gz freeipa.git-5f95fbfad2729e59d67730d2d476befa4e0a2e02.tar.xz freeipa.git-5f95fbfad2729e59d67730d2d476befa4e0a2e02.zip |
Add fallback for httpd restarts on sysV platforms
httpd init script on sysV based platforms cannot guarantee that two
consecutive httpd service restarts succeed when run in a small
time distance.
Add fallback procedure that adds additional waiting time after such
failed restart attempt, and then try to stop and start the service
again.
https://fedorahosted.org/freeipa/ticket/2965
Diffstat (limited to 'ipapython')
-rw-r--r-- | ipapython/platform/redhat.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/ipapython/platform/redhat.py b/ipapython/platform/redhat.py index 3f35cfcc..3551c284 100644 --- a/ipapython/platform/redhat.py +++ b/ipapython/platform/redhat.py @@ -25,9 +25,11 @@ import stat import sys import socket import stat +import time from ipapython import ipautil from ipapython.platform import base +from ipapython.ipa_log_manager import root_logger from ipalib import api # All what we allow exporting directly from this module @@ -115,6 +117,19 @@ class RedHatSSHService(RedHatService): def get_config_dir(self, instance_name=""): return '/etc/ssh' +class RedHatHTTPDService(RedHatService): + def restart(self, instance_name="", capture_output=True, wait=True): + try: + super(RedHatHTTPDService, self).restart(instance_name, capture_output, wait) + except ipautil.CalledProcessError: + # http may have issues with binding to ports, try to fallback + # https://bugzilla.redhat.com/show_bug.cgi?id=845405 + root_logger.debug("%s restart failed, try to stop&start again", self.service_name) + time.sleep(5) + self.stop(instance_name, capture_output) + time.sleep(5) + self.start(instance_name, capture_output, wait) + class RedHatAuthConfig(base.AuthConfig): """ AuthConfig class implements system-independent interface to configure @@ -145,6 +160,8 @@ class RedHatAuthConfig(base.AuthConfig): def redhat_service(name): if name == 'sshd': return RedHatSSHService(name) + elif name == 'httpd': + return RedHatHTTPDService(name) return RedHatService(name) class RedHatServices(base.KnownServices): |