pinhole: do not log power loss error on pinhole

If the user did a pinhole reset to reboot the BMC and that happens to
cause a chassis power off, do not log an error as this was user
initiated. A separate error is logged to inform the user a pinhole
reset was done to the system.

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Ib9059eeaa4325e7742ce024eed2f33923c6dea2a
diff --git a/chassis_state_manager.cpp b/chassis_state_manager.cpp
index d23f348..4d6b445 100644
--- a/chassis_state_manager.cpp
+++ b/chassis_state_manager.cpp
@@ -105,18 +105,26 @@
 
             if (deserializeStateChangeTime(lastTime, lastState))
             {
+                // If power was on before the BMC reboot and the reboot reason
+                // was not a pinhole reset, log an error
                 if (lastState == PowerState::On)
                 {
-                    if (standbyVoltageRegulatorFault())
-                    {
-                        report<Regulator>();
-                    }
-                    else
-                    {
-                        report<Blackout>();
-                    }
-
+                    info(
+                        "Chassis power was on before the BMC reboot and it is off now");
                     setStateChangeTime();
+
+                    if (phosphor::state::manager::utils::getGpioValue(
+                            "reset-cause-pinhole") != 1)
+                    {
+                        if (standbyVoltageRegulatorFault())
+                        {
+                            report<Regulator>();
+                        }
+                        else
+                        {
+                            report<Blackout>();
+                        }
+                    }
                 }
             }
         }