[PATCH] Strengthen the services command processing a bit.

David Shea dshea at redhat.com
Mon Aug 5 20:38:16 UTC 2013


On 08/05/2013 04:14 PM, Chris Lumens wrote:
> (1) Allow specified services to end with ".service" already.
> (2) Process individually so one bad service doesn't take down the whole
> command.
> ---
>   pyanaconda/kickstart.py | 15 +++++++++------
>   1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
> index 0fa53c6..88343da 100644
> --- a/pyanaconda/kickstart.py
> +++ b/pyanaconda/kickstart.py
> @@ -1256,15 +1256,18 @@ class SELinux(commands.selinux.FC3_SELinux):
>   
>   class Services(commands.services.FC6_Services):
>       def execute(self, storage, ksdata, instClass):
> -        disabled = map(lambda s: s + ".service", self.disabled)
> -        enabled = map(lambda s: s + ".service", self.enabled)
> +        for svc in self.disabled:
> +            if not svc.endswith(".service"):
> +                svc += ".service"
>   
> -        if disabled:
> -            iutil.execWithRedirect("systemctl", ["disable"] + disabled,
> +            iutil.execWithRedirect("systemctl", ["disable", svc],
>                                      root=ROOT_PATH)
>   
> -        if enabled:
> -            iutil.execWithRedirect("systemctl", ["enable"] + enabled,
> +        for svc in self.enabled:
> +            if not svc.endswith(".service"):
> +                svc += ".service"
> +
> +            iutil.execWithRedirect("systemctl", ["enable", svc],
>                                      root=ROOT_PATH)
>   
>   class Timezone(commands.timezone.F18_Timezone):
Ack


More information about the anaconda-patches mailing list