Enable client type certificate install interface
Added support to restart unit, incase reload is not supported
by the unit, also enabled client certificate install function.
Change-Id: I68b7eeb1f81f6faf65dcfb8e6c5b9b907145747a
Signed-off-by: Jayanth Othayoth <ojayanth@in.ibm.com>
diff --git a/certs_manager.cpp b/certs_manager.cpp
index 4017ff7..28b0957 100644
--- a/certs_manager.cpp
+++ b/certs_manager.cpp
@@ -73,16 +73,19 @@
{
if (!unit.empty())
{
- reload(unit);
+ reloadOrReset(unit);
}
}
void Manager::clientInstall()
{
- // Do nothing now
+ if (!unit.empty())
+ {
+ reloadOrReset(unit);
+ }
}
-void Manager::reload(const std::string& unit)
+void Manager::reloadOrReset(const std::string& unit)
{
constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
constexpr auto SYSTEMD_OBJ_PATH = "/org/freedesktop/systemd1";
@@ -90,8 +93,9 @@
try
{
- auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
- SYSTEMD_INTERFACE, "ReloadUnit");
+ auto method =
+ bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
+ SYSTEMD_INTERFACE, "ReloadOrRestartUnit");
method.append(unit, "replace");
@@ -99,7 +103,8 @@
}
catch (const sdbusplus::exception::SdBusError& e)
{
- log<level::ERR>("Failed to reload service", entry("ERR=%s", e.what()),
+ log<level::ERR>("Failed to reload or restart service",
+ entry("ERR=%s", e.what()),
entry("UNIT=%s", unit.c_str()));
elog<InternalFailure>();
}