clang-format this repo
Use the proper-clang-format file on this repository as required by
the openbmc documentation.
Change-Id: I4f1e0d707388605f1e818dfdc647533a335e5f2d
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
diff --git a/fail-monitor/monitor.cpp b/fail-monitor/monitor.cpp
index 1936e27..9a0722a 100644
--- a/fail-monitor/monitor.cpp
+++ b/fail-monitor/monitor.cpp
@@ -29,13 +29,12 @@
constexpr auto START_METHOD = "StartUnit";
constexpr auto STOP_METHOD = "StopUnit";
-constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
-constexpr auto SYSTEMD_OBJ_PATH = "/org/freedesktop/systemd1";
+constexpr auto SYSTEMD_SERVICE = "org.freedesktop.systemd1";
+constexpr auto SYSTEMD_OBJ_PATH = "/org/freedesktop/systemd1";
constexpr auto SYSTEMD_INTERFACE = "org.freedesktop.systemd1.Manager";
constexpr auto SYSTEMD_PROPERTY_INTERFACE = "org.freedesktop.DBus.Properties";
constexpr auto SYSTEMD_UNIT_INTERFACE = "org.freedesktop.systemd1.Unit";
-
void Monitor::analyze()
{
if (inFailedState(std::move(getSourceUnitPath())))
@@ -44,15 +43,12 @@
}
}
-
bool Monitor::inFailedState(const std::string&& path)
{
sdbusplus::message::variant<std::string> property;
- auto method = bus.new_method_call(SYSTEMD_SERVICE,
- path.c_str(),
- SYSTEMD_PROPERTY_INTERFACE,
- "Get");
+ auto method = bus.new_method_call(SYSTEMD_SERVICE, path.c_str(),
+ SYSTEMD_PROPERTY_INTERFACE, "Get");
method.append(SYSTEMD_UNIT_INTERFACE, "ActiveState");
@@ -60,7 +56,7 @@
if (reply.is_method_error())
{
log<level::ERR>("Failed reading ActiveState DBus property",
- entry("UNIT=%s", source.c_str()));
+ entry("UNIT=%s", source.c_str()));
// TODO openbmc/openbmc#851 - Once available, throw returned error
throw std::runtime_error("Failed reading ActiveState DBus property");
}
@@ -71,22 +67,19 @@
return (value == FAILED_STATE);
}
-
std::string Monitor::getSourceUnitPath()
{
sdbusplus::message::object_path path;
- auto method = bus.new_method_call(SYSTEMD_SERVICE,
- SYSTEMD_OBJ_PATH,
- SYSTEMD_INTERFACE,
- "GetUnit");
+ auto method = bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
+ SYSTEMD_INTERFACE, "GetUnit");
method.append(source);
auto reply = bus.call(method);
if (reply.is_method_error())
{
log<level::ERR>("Failed GetUnit DBus method call",
- entry("UNIT=%s", source.c_str()));
+ entry("UNIT=%s", source.c_str()));
// TODO openbmc/openbmc#851 - Once available, throw returned error
throw std::runtime_error("Failed GetUnit DBus method call");
}
@@ -96,12 +89,10 @@
return static_cast<std::string>(path);
}
-
void Monitor::runTargetAction()
{
- //Start or stop the target unit
- auto methodCall = (action == Action::start) ?
- START_METHOD : STOP_METHOD;
+ // Start or stop the target unit
+ auto methodCall = (action == Action::start) ? START_METHOD : STOP_METHOD;
log<level::INFO>("The source unit is in failed state, "
"running target action",
@@ -109,10 +100,8 @@
entry("TARGET=%s", target.c_str()),
entry("ACTION=%s", methodCall));
- auto method = this->bus.new_method_call(SYSTEMD_SERVICE,
- SYSTEMD_OBJ_PATH,
- SYSTEMD_INTERFACE,
- methodCall);
+ auto method = this->bus.new_method_call(SYSTEMD_SERVICE, SYSTEMD_OBJ_PATH,
+ SYSTEMD_INTERFACE, methodCall);
method.append(target);
method.append("replace");
@@ -121,12 +110,11 @@
if (reply.is_method_error())
{
log<level::ERR>("Failed to run action on the target unit",
- entry("UNIT=%s", target.c_str()));
+ entry("UNIT=%s", target.c_str()));
// TODO openbmc/openbmc#851 - Once available, throw returned error
throw std::runtime_error("Failed to run action on the target unit");
}
}
-
}
}
}