watchdog: Handle systemd StartUnit errors
Currently, if systemd returns an error upon trying to StartUnit in the
timeout of the watchdog the entire daemon will crash.
Sep 28 22:59:09 phosphor-watchdog[2462]: Timer Expired
Sep 28 22:59:09 phosphor-watchdog[2462]: watchdog: Timed out
Sep 28 22:59:09 phosphor-watchdog[2462]: terminate called after throwing an instance of 'sdbusplus::exception::SdBusError'
Sep 28 22:59:09 phosphor-watchdog[2462]: what(): sd_bus_call noreply: org.freedesktop.DBus.Error.InvalidArgs: Unit ho
st-watchdog-reset.service is not loaded properly: Invalid argument.
This patch fixes the behavior so we get something more like:
Oct 04 07:12:14 phosphor-watchdog[10897]: watchdog: Timed out
Oct 04 07:12:14 phosphor-watchdog[10897]: watchdog: Failed to start unit
Oct 04 07:12:16 phosphor-watchdog[10897]: watchdog: disabled
Tested:
Ran with a bogus systemd target which used to throw errors which are
now correctly handled without crashing.
Change-Id: I4cf6ffded789e49d2329439165927cc227e2e79e
Signed-off-by: William A. Kennington III <wak@google.com>
1 file changed