[systemd-devel] [PATCH 2/3] install: don't allow to enable/disable templates

Tom Gundersen teg at jklm.no
Thu Aug 8 06:35:24 PDT 2013


Hi Michal,

On Thu, Aug 8, 2013 at 3:19 PM, Michal Sekletar <msekleta at redhat.com> wrote:
> Calling enable on template units doesn't make sense since it is possible
> to enable instances directly and users are not forced to use Alias=
> trickery anymore.

It actually might make sense to still call enable on a template unit
with an Alias:

Imagine foo at .service with Alias=bar at .service. In this case you want to
be able to do "systemctl enable foo at .service", and then "systemctl
start bar at baz.service" should start the instance foo at baz.service. An
example where this would be useful is for "systemctl enable
kmsconvt at .service" to make the kmsconvt template override the autovt
template.

However, we definitely don't want to allow a template name in
WantedBy= or RequiredBy= (this doesn't make any sense as "systemctl
start foo at .service" is invalid).

Currently we don't really verify what is given in
Alias/WantedBy/RequiredBy at all at enable time (only at runtime), but
I think we should do this using unit_name_is_valid(name,true) for
Alias and unit_name_is_valid(name,false) for the other two.

What do you think?

Cheers,

Tom


More information about the systemd-devel mailing list