chiark / gitweb /
systemctl: handle correctly template units for edit verb
authorRonny Chevalier <chevalier.ronny@gmail.com>
Sat, 13 Dec 2014 14:14:48 +0000 (15:14 +0100)
committerRonny Chevalier <chevalier.ronny@gmail.com>
Sat, 13 Dec 2014 14:29:47 +0000 (15:29 +0100)
commite9e310f8e99c63c764f71ed0c224ccd3cceb90c7
treef0f04276817c61e8cc36c808f1be6d9b12d7e00f
parentfee0a921830166abffe5a806a512da6ceb2fe2eb
systemctl: handle correctly template units for edit verb

Previously, if we provided getty@.service to systemctl edit it would
have failed when using the bus because it is an invalid unit name.
But it would have succeeded when searching in the filesystem.

Now, we check if we have a template, if we do we search in the
filesystem, if we don't have a templae and we can use the bus, we do.

Furthermore, if we provided getty@tty1.service it would not have worked
when searching the filesystem, but it would have worked with the bus.
So now, when using the filesystem we use the template name and not the
unit name, and the same when logging errors.

(Also did a refactoring to avoid a long function)
src/systemctl/systemctl.c