Avoid calling Activation repeatedly during update

The Activation code monitors the systemd service files that
create the volumes, and sets the value to Activating if the
services are running, or Failed if they fail.

This monitoring code checks the name of the service file for
when it fails, but it wasn't checking it for when it succeeds,
leading to any systemd file that finished to trigger calling
the Activation function multiple times.

Also avoid removing the Priority object if the requested
Activation value is Activating, since that's what the value
the monitoring code calls during the update.

Part of openbmc/openbmc#2764

Change-Id: Ib6681ce5d63d184a2ee9ffe05c083e1085efd2ac
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/activation.cpp b/activation.cpp
index 72cc212..ecfcda4 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -41,7 +41,8 @@
         Activations
 {
 
-    if (value != softwareServer::Activation::Activations::Active)
+    if ((value != softwareServer::Activation::Activations::Active) &&
+        (value != softwareServer::Activation::Activations::Activating))
     {
         redundancyPriority.reset(nullptr);
     }
@@ -212,16 +213,18 @@
         activationProgress->progress(activationProgress->progress() + 50);
     }
 
-    if (rwVolumeCreated && roVolumeCreated)
+    if (newStateUnit == rwServiceFile || newStateUnit == roServiceFile)
     {
-        Activation::activation(
-                softwareServer::Activation::Activations::Activating);
-    }
-
-    if ((newStateUnit == rwServiceFile || newStateUnit == roServiceFile) &&
-        (newStateResult == "failed" || newStateResult == "dependency"))
-    {
-        Activation::activation(softwareServer::Activation::Activations::Failed);
+        if (newStateResult == "failed" || newStateResult == "dependency")
+        {
+            Activation::activation(
+                    softwareServer::Activation::Activations::Failed);
+        }
+        else if (rwVolumeCreated && roVolumeCreated)
+        {
+            Activation::activation(
+                    softwareServer::Activation::Activations::Activating);
+        }
     }
 
     return;