Make instantiated mapper services oneshot
The systemd issue which prevented use of Restart= policy in oneshot
services has been fixed. Therefore, mapper-wait@ and
mapper-subtree-remove@ services can be cleaned up and simplified.
Tested:
1. Created a simple test.service which has Wants/After dependency on
mapper-wait@-some-object.service, and just echos "TEST" to journal.
2. systemctl start test; verify it hangs since object doesn't exist yet
3. Start service which creates /some/object; verify test.service is
started.
4. systemctl restart test; verify it starts immediately
5. Stop service which publishes /some/object
6. systemctl restart test; verify it starts immediately, since
mapper-wait@-some-object is still active, even though the object is
gone.
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
Change-Id: I7fcb1be0aeb9c2687645206f0a02ac4f068c3b31
diff --git a/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service b/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
index 4bd411e..4fad8fa 100644
--- a/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
+++ b/recipes-phosphor/dbus/phosphor-mapper/mapper-subtree-remove@.service
@@ -4,19 +4,9 @@
After=obmc-mapper.target
[Service]
-# We are using a Type=simple service instead of the normal Type=oneshot
-# since Type=oneshot can't have Restart= lines
-# https://github.com/systemd/systemd/issues/2582
-# Unfortunately Type=oneshot services halt any services which order after
-# the oneshot on the completion of ExecStart= lines. For Type=simple, the
-# halting is only until ExecStartPre lines have completed and ExecStart has
-# begun executing. Since we want to wait for the `mapper wait` process to
-# finish, it must be an ExecStartPre. All Type=simple services require an
-# ExecStart so we use `true` as a placeholder to satisfy the requirement.
-Type=simple
+Type=oneshot
RemainAfterExit=no
Restart=on-failure
TimeoutStartSec=infinity
-ExecStartPre=/usr/bin/env mapper subtree-remove %I
-ExecStart=/usr/bin/env true
+ExecStart=/usr/bin/env mapper subtree-remove %I
SyslogIdentifier=mapper