Subject: bug#77109: [feature] [shepherd] Accept multiple services for actions

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 20 Mar 2025 12:16:56 +0900

Hi Tomas,

Tomas Volf <[email-masked]> writes:

> Maxim Cournoyer <[email-masked]> writes:
>
>> Hi,
>>
>> Coming from a world where 'guix install package1 package2 ...' is a thing, I
>> sometimes would like to be able to do:
>>
>> herd restart service1 service2 ...
>>
>> Which Shepherd gladly accepts but disregarding service2 ...
>>
>> Would it be a good idea to teach the Shepherd how to do this?
>
> I guess it could be special-cased for start, stop, restart, since these
> three do not take (by default) any arguments (I *think* you can make
> `start' procedure taking arguments?  I have never tried.).  But for
> general case, the `service2' is passed as an argument to the action
> `restart' of service `service1'.

I think even special cased, it wouldn't be too surprising.  I've never
had a though of overriding the base actions for these to extend them in
what would be surprising ways ;-).

> I am not sure having different semantics for restart and any other
> action is a good idea though.
>
> But what I think would be a good idea is for start, stop, restart to
> signal an error when additional unexpected arguments are provided.

Failing to change the behavior as suggested, that would still be an
improvement, yes.  But then you'd also be special casing these actions,
as actions are designed to receive an arbitrary number of arguments and
cannot forcibly know which ones are really used/necessary in advance?

-- 
Thanks,
Maxim