util: Reset Failed Before Restarting Service

If we don't reset the failed counter in systemd for a specific service
like systemd-networkd, restarts won't always be issued as expected. If
the service fails due to a bad configuration, future changes that would
normally put it in a valid state will be unable to restart it since it
hit the reset threshold for the given time window.

Tested:
    Built and ran on a zaius for testing. Issuing bad network
    configuration changes over ipmi no longer prevents future changes
    from fixing systemd-networkd.

Change-Id: I646309001a257b12e2df006d8c420c93c5c0bca8
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/network_manager.cpp b/network_manager.cpp
index bd1244d..c4ab0da 100644
--- a/network_manager.cpp
+++ b/network_manager.cpp
@@ -217,6 +217,21 @@
     try
     {
         auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
+                                          SYSTEMD_INTERFACE, "ResetFailedUnit");
+        method.append(unit);
+        bus.call_noreply(method);
+    }
+    catch (const sdbusplus::exception::SdBusError& ex)
+    {
+        log<level::ERR>("Failed to reset failed unit",
+                        entry("UNIT=%s", unit.c_str()),
+                        entry("ERR=%s", ex.what()));
+        elog<InternalFailure>();
+    }
+
+    try
+    {
+        auto method = bus.new_method_call(SYSTEMD_BUSNAME, SYSTEMD_PATH,
                                           SYSTEMD_INTERFACE, "RestartUnit");
         method.append(unit.c_str(), "replace");
         bus.call_noreply(method);