shared/install: report invalid unit files slightly better
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 17 Oct 2016 02:57:38 +0000 (22:57 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Oct 2016 01:30:51 +0000 (21:30 -0400)
commit59108fbecb831664cb968ad04acb77c55a756eb1
treea35c7776b682473e4807c6e2a79b418961341671
parenta6612e658c19717a51366fa2e4925e557d95a427
shared/install: report invalid unit files slightly better

When a unit file is invalid, we'd return an error without any details:
$ systemctl --root=/ enable testing@instance.service
Failed to enable: Invalid argument.

Fix things to at least print the offending file name:
$ systemctl enable testing@instance.service
Failed to enable unit: File testing@instance.service: Invalid argument

$ systemctl --root=/ enable testing@instance.service
Failed to enable unit, file testing@instance.service: Invalid argument.

A real fix would be to pass back a proper error message from conf-parser.
But this would require major surgery, since conf-parser functions now
simply print log errors, but we would need to return them over the bus.
So let's just print the file name, to indicate where the error is.

(Incomplete) fix for #4210.
src/shared/install.c
src/test/test-install-root.c