[anaconda][rhel7-branch/master/f23-branch][PATCH] Verify Initial Setup services are present before turning them ON/OFF (#1252444)
Martin Kolman
mkolman at redhat.com
Thu Sep 3 08:37:58 UTC 2015
On Wed, 2015-09-02 at 16:41 +0200, Vratislav Podzimek wrote:
> On Wed, 2015-09-02 at 14:43 +0200, Martin Kolman wrote:
> > The systemd enable/disable command is atomic, so if it is called on
> > multiple services and one of them is not present, no changes will
> > be
> > made.
> >
> > So check that the individual Initial Setup services (text and/or
> > graphical)
> > are present before trying to enable or disable them.
> >
> > Resolves: rhbz#1252444
> > Signed-off-by: Martin Kolman <mkolman at redhat.com>
> > ---
> > pyanaconda/kickstart.py | 20 ++++++++++----------
> > 1 file changed, 10 insertions(+), 10 deletions(-)
> >
> > diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> > index 0b1ed25..bf31d82 100644
> > --- a/pyanaconda/kickstart.py
> > +++ b/pyanaconda/kickstart.py
> > @@ -698,18 +698,18 @@ class
> > Firstboot(commands.firstboot.FC3_Firstboot):
> > 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"
> > - elif self.firstboot == FIRSTBOOT_RECONFIG:
> > - f = open(iutil.getSysroot() + "/etc/reconfigSys",
> > "w+")
> > + # find if the unit files for the Initial Setup services
> > are installed
> > + services = [name for name in services if
> > os.path.exists(os.path.join(iutil.getSysroot(),
> > "lib/systemd/system/", name))]
> > + if services and self.firstboot == FIRSTBOOT_RECONFIG:
> > + # write the reconfig trigger file
> > + f = open(os.path.join(iutil.getSysroot(),
> > "/etc/reconfigSys"), "w+")
> > f.close()
> >
> > - iutil.execInSysroot("systemctl", [action] + services)
> > + for service in services:
> > + # enable/disable all installed Initial Setup services
> > + if self.firstboot == FIRSTBOOT_SKIP:
> > + action = "disable"
> I know we don't care about these things, but this if should go
> outside
> of the cycle.
Makes sense, changing locally. :)
>
> Looks good to me otherwise.
>
More information about the anaconda-patches
mailing list