[ONOS-7352] Activate applications locally when restoring old version after upgrade failure

Change-Id: I9eeff0fc6dbfa6b82c074a0e3a8ca1b4e0fa1227
diff --git a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
index a2c652a..ffda6f5 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/app/DistributedApplicationStore.java
@@ -197,7 +197,7 @@
      * Upgrades application versions for existing applications that are stored on disk after an upgrade.
      */
     private void upgradeExistingApplications() {
-        if (upgradeService.isUpgrading() && upgradeService.isLocalUpgraded()) {
+        if (upgradeService.isUpgrading() && (upgradeService.isLocalActive() || upgradeService.isLocalUpgraded())) {
             getApplicationNames().forEach(appName -> {
                 // Only update the application version if the application has already been installed.
                 ApplicationId appId = getId(appName);