Red Hat Bugzilla – Bug 812554
Shutting down target does not shutdown it's units.
Last modified: 2012-04-16 15:14:08 EDT
Description of problem:
The summary says it all
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create test target
2. Create a test service and link it to the test.target.wants directory
3. Start the test target
4. Check the status of the test target and the test service
5. Stop the test target
6. Check the status of the test target and the test service
Starting the test target, starts the test target and it's test service however stopping the test target does not stop the test service
The test service to be stopped when test target is stopped.
The expectation is baseless. When the service has no requirement dependency on the target, there's no reason to stop the service.
You can however get the behaviour you want by using StopWhenUnneeded=yes in the service unit. Or you may want to add some kind of a requirement dependency of the service on the target. It depends on the specific scenario.
In this case I was testing template units as in creating a test.target then generate 50 dummy services which got linked into the test.target.wants directory then start the target to ensure those 50 template based unit got started and stopping it again to ensure those 50 units got stopped when the test.target was stopped.
So what's the best way you think to solve that to get those 50 template based units stopped when the test.target gets stopped since I think the best way to solve the lack of [Install] section in template based unit is this approach and I'm pretty sure that it would not before long that an request would fly in to be able to shutdown all the units in given target?