[master/f21-branch][PATCH] Do not try to disable no firstboot services (#1139621)

Vratislav Podzimek vpodzime at redhat.com
Tue Sep 9 11:21:43 UTC 2014


If there are no first boot services installed, just return early from the
ksdata.firstboot.execute instead of trying to run 'systemctl disable' on those
non-existing services as that may lead to issues.

This is what we do on the rhel7-branch.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/kickstart.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index cb86c9f..8891d0b 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -661,6 +661,13 @@ class Firstboot(commands.firstboot.FC3_Firstboot):
 
     def execute(self, *args):
         action = "enable"
+        services = ["initial-setup-graphical.service",
+                    "initial-setup-text.service"]
+
+        if not any(os.path.exists(iutil.getSysroot() + "/lib/systemd/system/" + path)
+                   for path in services):
+             # none of the first boot utilities installed, nothing to do here
+             return
 
         if self.firstboot == FIRSTBOOT_SKIP:
             action = "disable"
@@ -668,8 +675,7 @@ class Firstboot(commands.firstboot.FC3_Firstboot):
             f = open(iutil.getSysroot() + "/etc/reconfigSys", "w+")
             f.close()
 
-        iutil.execInSysroot("systemctl", [action, "initial-setup-graphical.service",
-                                          "initial-setup-text.service"])
+        iutil.execInSysroot("systemctl", [action] + services)
 
 class Group(commands.group.F12_Group):
     def execute(self, storage, ksdata, instClass, users):
-- 
1.9.3



More information about the anaconda-patches mailing list