From: "Brian C. Lane" <bcl(a)redhat.com>
.service isn't the only unit type, if the user specifies a specific
unit, don't add .service to the end. If no service is specified, add
.service.
---
pyanaconda/constants.py | 4 ++++
pyanaconda/kickstart.py | 6 +++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/constants.py b/pyanaconda/constants.py
index df1a171..78e7c35 100644
--- a/pyanaconda/constants.py
+++ b/pyanaconda/constants.py
@@ -189,3 +189,7 @@
PAYLOAD_STATUS_PROBING_STORAGE = N_("Probing storage...")
PAYLOAD_STATUS_PACKAGE_MD = N_("Downloading package metadata...")
PAYLOAD_STATUS_GROUP_MD = N_("Downloading group metadata...")
+
+# systemd unit suffixes from
http://www.freedesktop.org/software/systemd/man/systemd.unit.html
+SYSTEMD_UNITS = ("service", "socket", "device",
"mount", "automount", "swap",
+ "target", "path", "timer",
"snapshot", "slice", "scope")
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 4fead23..696e9d5 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -44,7 +44,7 @@
import os.path
import tempfile
from pyanaconda.flags import flags, can_touch_runtime_system
-from pyanaconda.constants import ADDON_PATHS, IPMI_ABORTED
+from pyanaconda.constants import ADDON_PATHS, IPMI_ABORTED, SYSTEMD_UNITS
import shlex
import requests
import sys
@@ -1641,13 +1641,13 @@ def execute(self, *args):
class Services(commands.services.FC6_Services):
def execute(self, storage, ksdata, instClass):
for svc in self.disabled:
- if not svc.endswith(".service"):
+ if "." not in svc or svc.rsplit(".", 1)[-1] not in
SYSTEMD_UNITS:
svc += ".service"
iutil.execInSysroot("systemctl", ["disable", svc])
for svc in self.enabled:
- if not svc.endswith(".service"):
+ if "." not in svc or svc.rsplit(".", 1)[-1] not in
SYSTEMD_UNITS:
svc += ".service"
iutil.execInSysroot("systemctl", ["enable", svc])
--
To view this commit on github, visit
https://github.com/rhinstaller/anaconda/commit/5dd1a9eeded71a2abe859f9382...