Revert "Revert "Wait for obmc-flash-bmc-updateubootvars@.service""

This reverts commit e24fd6f7deadddc2867b2c417590da0ff093e5e2.

The code that waits for the service file to complete causes
intermittent issues, so will be reverted.

Change-Id: I830f8a2e4914694889c3626bb67bd1fe422e984d
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/activation.cpp b/activation.cpp
index dbfe030..ee0bcf8 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -115,31 +115,37 @@
         }
         else if (rwVolumeCreated == true && roVolumeCreated == true)
         {
-            activationProgress->progress(90);
-
-            if (!redundancyPriority)
+            if (ubootEnvVarsUpdated == false)
             {
-                redundancyPriority =
-                    std::make_unique<RedundancyPriority>(bus, path, *this, 0);
+                activationProgress->progress(90);
+
+                if (!redundancyPriority)
+                {
+                    redundancyPriority = std::make_unique<RedundancyPriority>(
+                        bus, path, *this, 0);
+                }
             }
+            else
+            {
+                activationProgress->progress(100);
 
-            activationProgress->progress(100);
+                activationBlocksTransition.reset(nullptr);
+                activationProgress.reset(nullptr);
 
-            activationBlocksTransition.reset(nullptr);
-            activationProgress.reset(nullptr);
+                rwVolumeCreated = false;
+                roVolumeCreated = false;
+                ubootEnvVarsUpdated = false;
+                Activation::unsubscribeFromSystemdSignals();
 
-            rwVolumeCreated = false;
-            roVolumeCreated = false;
-            Activation::unsubscribeFromSystemdSignals();
+                // Remove version object from image manager
+                Activation::deleteImageManagerObject();
 
-            // Remove version object from image manager
-            Activation::deleteImageManagerObject();
+                // Create active association
+                parent.createActiveAssociation(path);
 
-            // Create active association
-            parent.createActiveAssociation(path);
-
-            return softwareServer::Activation::activation(
-                softwareServer::Activation::Activations::Active);
+                return softwareServer::Activation::activation(
+                    softwareServer::Activation::Activations::Active);
+            }
         }
     }
     else
@@ -171,6 +177,7 @@
 {
     rwVolumeCreated = false;
     roVolumeCreated = false;
+    ubootEnvVarsUpdated = false;
 
     if ((value == softwareServer::Activation::RequestedActivations::Active) &&
         (softwareServer::Activation::requestedActivation() !=
@@ -222,6 +229,8 @@
 
     auto rwServiceFile = "obmc-flash-bmc-ubirw.service";
     auto roServiceFile = "obmc-flash-bmc-ubiro@" + versionId + ".service";
+    auto ubootVarsServiceFile =
+        "obmc-flash-bmc-updateubootvars@" + versionId + ".service";
 
     if (newStateUnit == rwServiceFile && newStateResult == "done")
     {
@@ -235,14 +244,21 @@
         activationProgress->progress(activationProgress->progress() + 50);
     }
 
-    if (newStateUnit == rwServiceFile || newStateUnit == roServiceFile)
+    if (newStateUnit == ubootVarsServiceFile && newStateResult == "done")
+    {
+        ubootEnvVarsUpdated = true;
+    }
+
+    if (newStateUnit == rwServiceFile || newStateUnit == roServiceFile ||
+        newStateUnit == ubootVarsServiceFile)
     {
         if (newStateResult == "failed" || newStateResult == "dependency")
         {
             Activation::activation(
                 softwareServer::Activation::Activations::Failed);
         }
-        else if (rwVolumeCreated && roVolumeCreated) // Volumes were created
+        else if ((rwVolumeCreated && roVolumeCreated) || // Volumes were created
+                 (ubootEnvVarsUpdated)) // Environment variables were updated
         {
             Activation::activation(
                 softwareServer::Activation::Activations::Activating);
diff --git a/activation.hpp b/activation.hpp
index 50f5338..51756f2 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -311,6 +311,10 @@
     /** @brief Tracks whether the read-only volume has been created as
      * part of the activation process. **/
     bool roVolumeCreated = false;
+
+    /** @brief Tracks if the service that updates the U-Boot environment
+     *         variables has completed. **/
+    bool ubootEnvVarsUpdated = false;
 };
 
 } // namespace updater