Fedora renamed fedora-domainname.service to nis-domainname.service

Resolves: #1588192
This commit is contained in:
Rob Crittenden 2018-06-11 15:51:51 -04:00
parent 023dc4e57a
commit 5fd105c019
2 changed files with 77 additions and 1 deletions

View File

@ -0,0 +1,70 @@
From 907e1649580b8677d56da6207731addc178dca80 Mon Sep 17 00:00:00 2001
From: Christian Heimes <cheimes@redhat.com>
Date: Jun 15 2018 06:30:55 +0000
Subject: Fedora 29 renamed fedora-domainname.service
In Fedora 29, the fedora-domainname.service has been renamed to
nis-domainname.service like on RHEL. The ipaplatform service module for
Fedora now only renames the service, when it detects the presence of
fedora-domainname.service.
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1588192
Fixes: https://pagure.io/freeipa/issue/7582
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
---
diff --git a/ipaplatform/fedora/services.py b/ipaplatform/fedora/services.py
index 6735153..09ba2e8 100644
--- a/ipaplatform/fedora/services.py
+++ b/ipaplatform/fedora/services.py
@@ -24,14 +24,23 @@ Contains Fedora-specific service class implementations.
from __future__ import absolute_import
+import os
+
from ipaplatform.redhat import services as redhat_services
# Mappings from service names as FreeIPA code references to these services
# to their actual systemd service names
fedora_system_units = redhat_services.redhat_system_units.copy()
-# Service that sets domainname on Fedora is called fedora-domainname.service
-fedora_system_units['domainname'] = 'fedora-domainname.service'
+# Fedora 28 and earlier have fedora-domainname.service. Starting from
+# Fedora 29, the service is called nis-domainname.service as defined in
+# ipaplatform.redhat.services.
+HAS_FEDORA_DOMAINNAME_SERVICE = os.path.isfile(
+ "/usr/lib/systemd/system/fedora-domainname.service"
+)
+
+if HAS_FEDORA_DOMAINNAME_SERVICE:
+ fedora_system_units['domainname'] = 'fedora-domainname.service'
# Service classes that implement Fedora-specific behaviour
@@ -44,7 +53,7 @@ class FedoraService(redhat_services.RedHatService):
# of specified name
def fedora_service_class_factory(name, api=None):
- if name == 'domainname':
+ if HAS_FEDORA_DOMAINNAME_SERVICE and name == 'domainname':
return FedoraService(name, api)
return redhat_services.redhat_service_class_factory(name, api)
diff --git a/ipaplatform/redhat/services.py b/ipaplatform/redhat/services.py
index 80ad62b..390bbb0 100644
--- a/ipaplatform/redhat/services.py
+++ b/ipaplatform/redhat/services.py
@@ -47,6 +47,7 @@ redhat_system_units = dict((x, "%s.service" % x)
redhat_system_units['rpcgssd'] = 'nfs-secure.service'
redhat_system_units['rpcidmapd'] = 'nfs-idmap.service'
+redhat_system_units['domainname'] = 'nis-domainname.service'
# Rewrite dirsrv and pki-tomcatd services as they support instances via separate
# service generator. To make this working, one needs to have both foo@.servic

View File

@ -119,7 +119,7 @@
Name: freeipa
Version: %{VERSION}
Release: 3%{?dist}
Release: 4%{?dist}
Summary: The Identity, Policy and Audit system
Group: System Environment/Base
@ -128,6 +128,8 @@ URL: https://www.freeipa.org/
Source0: https://releases.pagure.org/freeipa/freeipa-%{VERSION}.tar.gz
Source1: https://releases.pagure.org/freeipa/freeipa-%{VERSION}.tar.gz.asc
Patch0001: 0001-Fedora-29-renamed-fedora-domainname.service.patch
# For the timestamp trick in patch application
BuildRequires: diffstat
@ -1748,6 +1750,10 @@ fi
%endif # with_ipatests
%changelog
* Thu Jun 15 2018 Rob Crittenden <rcritten@redhat.com> - 4.6.90.pre2-4
- Rename service fedora-domainname.service to nis-domainname.service
(#1588192)
* Wed May 16 2018 Alexander Bokovoy <abokovoy@redhat.com> - 4.6.90.pre2-3
- Fine tune packaging of server templates so that it doesn't include
freeipa.template which always go to freeipa-client-common