summaryrefslogtreecommitdiffstats
path: root/control/manager.cpp
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2018-05-09 13:06:28 -0500
committerMatthew Barth <msbarth@linux.ibm.com>2018-05-17 17:08:06 +0000
commit2029106af90bcdfd6a640a21c2c2eff36cb95f67 (patch)
tree015a8f6e2480d4336a551b8a0cdf5d6e1b077d4c /control/manager.cpp
parent803d35bce81427bc82e999c45174fc2e9b6c3871 (diff)
downloadphosphor-fan-presence-2029106af90bcdfd6a640a21c2c2eff36cb95f67.tar.gz
phosphor-fan-presence-2029106af90bcdfd6a640a21c2c2eff36cb95f67.zip
Use shared callMethod function in control manager
To better handle exit/restart of the fan control application use the shared callMethod function to call systemd's startunit on the fan control ready target. This allows the fan control application to exit and restart quickly in its allowed attempts configured in systemd. Tested: StartUnit on fan control ready target works the same Change-Id: Idce2d8831b4e8de0ef181a0849587e465419f68c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'control/manager.cpp')
-rw-r--r--control/manager.cpp28
1 files changed, 8 insertions, 20 deletions
diff --git a/control/manager.cpp b/control/manager.cpp
index a322c10..1078473 100644
--- a/control/manager.cpp
+++ b/control/manager.cpp
@@ -122,26 +122,14 @@ void Manager::doInit()
delay = sleep(delay);
}
- startFanControlReadyTarget();
-}
-
-
-void Manager::startFanControlReadyTarget()
-{
- auto method = _bus.new_method_call(SYSTEMD_SERVICE,
- SYSTEMD_OBJ_PATH,
- SYSTEMD_INTERFACE,
- "StartUnit");
-
- method.append(FAN_CONTROL_READY_TARGET);
- method.append("replace");
-
- auto response = _bus.call(method);
- if (response.is_method_error())
- {
- log<level::ERR>("Failed to start fan control ready target");
- elog<InternalFailure>();
- }
+ util::SDBusPlus::callMethod(
+ _bus,
+ SYSTEMD_SERVICE,
+ SYSTEMD_OBJ_PATH,
+ SYSTEMD_INTERFACE,
+ "StartUnit",
+ FAN_CONTROL_READY_TARGET,
+ "replace");
}
} // namespace control
OpenPOWER on IntegriCloud