diff options
author | Alexander Bokovoy <abokovoy@redhat.com> | 2012-02-01 17:51:24 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2012-02-08 20:11:20 -0500 |
commit | 8bba212c80163648ed3a6ba9cf77b1369a198053 (patch) | |
tree | 7cb065835ae0ee0ee8eb9e73b6c05b5f5cef388f /ipapython | |
parent | 2978e72e6ae4d4606efbc3d7b0d72f1ac74de440 (diff) | |
download | freeipa-8bba212c80163648ed3a6ba9cf77b1369a198053.tar.gz freeipa-8bba212c80163648ed3a6ba9cf77b1369a198053.tar.xz freeipa-8bba212c80163648ed3a6ba9cf77b1369a198053.zip |
Handle upgrade issues with systemd in Fedora 16 and above
Since 389-ds-base-1.2.10-0.8.a7 Directory Server's systemd settings are
configured via /etc/sysconfig/dirsrv.systemd. It means logic change in
systemd/fedora16 platform of FreeIPA.
Additionally, existing installs need to be handled during upgrade.
Fixes:
https://fedorahosted.org/freeipa/ticket/2117
https://fedorahosted.org/freeipa/ticket/2300
Diffstat (limited to 'ipapython')
-rw-r--r-- | ipapython/platform/fedora16.py | 22 | ||||
-rw-r--r-- | ipapython/platform/systemd.py | 16 |
2 files changed, 17 insertions, 21 deletions
diff --git a/ipapython/platform/fedora16.py b/ipapython/platform/fedora16.py index 0e476928e..369a1778b 100644 --- a/ipapython/platform/fedora16.py +++ b/ipapython/platform/fedora16.py @@ -59,24 +59,24 @@ class Fedora16Service(systemd.SystemdService): super(Fedora16Service, self).__init__(service_name) # Special handling of directory server service -# LimitNOFILE needs to be increased or any value set in the directory for this value will fail -# Read /lib/systemd/system/dirsrv@.service for details. -# We do modification of LimitNOFILE on service.enable() but we also need to explicitly enable instances -# to install proper symlinks as dirsrv.target.wants/ dependencies. Unfortunately, ipa-server-install -# does not do explicit dirsrv.enable() because the service startup is handled by ipactl. +# +# We need to explicitly enable instances to install proper symlinks as dirsrv.target.wants/ +# dependencies. Standard systemd service class does it on #enable() method call. Unfortunately, +# ipa-server-install does not do explicit dirsrv.enable() because the service startup is handled by ipactl. +# # If we wouldn't do this, our instances will not be started as systemd would not have any clue # about instances (PKI-IPA and the domain we serve) at all. Thus, hook into dirsrv.restart(). class Fedora16DirectoryService(Fedora16Service): def enable(self, instance_name=""): super(Fedora16DirectoryService, self).enable(instance_name) - srv_etc = os.path.join(self.SYSTEMD_ETC_PATH, self.service_name) - if os.path.exists(srv_etc): + dirsrv_systemd = "/etc/sysconfig/dirsrv.systemd" + if os.path.exists(dirsrv_systemd): # We need to enable LimitNOFILE=8192 in the dirsrv@.service - # We rely on the fact that [Service] section is the last one - # and if variable is not there, it will be added as the last line + # Since 389-ds-base-1.2.10-0.8.a7 the configuration of the service parameters is performed + # via /etc/sysconfig/dirsrv.systemd file which is imported by systemd into dirsrv@.service unit replacevars = {'LimitNOFILE':'8192'} - ipautil.config_replace_variables(srv_etc, replacevars=replacevars) - redhat.restore_context(srv_etc) + ipautil.inifile_replace_variables(dirsrv_systemd, 'service', replacevars=replacevars) + redhat.restore_context(dirsrv_systemd) ipautil.run(["/bin/systemctl", "--system", "daemon-reload"],raiseonerr=False) def restart(self, instance_name="", capture_output=True): diff --git a/ipapython/platform/systemd.py b/ipapython/platform/systemd.py index 3f1fe730e..ae06c0227 100644 --- a/ipapython/platform/systemd.py +++ b/ipapython/platform/systemd.py @@ -137,16 +137,12 @@ class SystemdService(base.PlatformService): if len(instance_name) > 0 and l > 1: # New instance, we need to do following: - # 1. Copy <service>@.service to /etc/systemd/system/ if it is not there - # 2. Make /etc/systemd/system/<service>.target.wants/ if it is not there - # 3. Link /etc/systemd/system/<service>.target.wants/<service>@<instance_name>.service to - # /etc/systemd/system/<service>@.service - srv_etc = os.path.join(self.SYSTEMD_ETC_PATH, self.service_name) + # 1. Make /etc/systemd/system/<service>.target.wants/ if it is not there + # 2. Link /etc/systemd/system/<service>.target.wants/<service>@<instance_name>.service to + # /lib/systemd/system/<service>@.service srv_tgt = os.path.join(self.SYSTEMD_ETC_PATH, self.SYSTEMD_SRV_TARGET % (elements[0])) srv_lnk = os.path.join(srv_tgt, self.service_instance(instance_name)) try: - if not ipautil.file_exists(srv_etc): - shutil.copy(self.lib_path, srv_etc) if not ipautil.dir_exists(srv_tgt): os.mkdir(srv_tgt) if os.path.exists(srv_lnk): @@ -156,11 +152,11 @@ class SystemdService(base.PlatformService): # object does not exist _or_ is a broken link if not os.path.islink(srv_lnk): # if it truly does not exist, make a link - os.symlink(srv_etc, srv_lnk) + os.symlink(self.lib_path, srv_lnk) else: # Link exists and it is broken, make new one os.unlink(srv_lnk) - os.symlink(srv_etc, srv_lnk) + os.symlink(self.lib_path, srv_lnk) ipautil.run(["/bin/systemctl", "--system", "daemon-reload"]) except: pass @@ -172,7 +168,7 @@ class SystemdService(base.PlatformService): if instance_name != "" and len(elements) > 1: # Remove instance, we need to do following: # Remove link from /etc/systemd/system/<service>.target.wants/<service>@<instance_name>.service - # to /etc/systemd/system/<service>@.service + # to /lib/systemd/system/<service>@.service srv_tgt = os.path.join(self.SYSTEMD_ETC_PATH, self.SYSTEMD_SRV_TARGET % (elements[0])) srv_lnk = os.path.join(srv_tgt, self.service_instance(instance_name)) try: |