Purge app bits off disk if install fails due to insufficient prerequisites.

Otherwise the system gets put in a state where the app can't be installed,
activated or uninstalled due to discrepency between ONOS store state and disk.

Change-Id: Ifbedeb34adf900304c096bff9b2d849932586dde
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 d2707d6..027e1a0 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
@@ -289,6 +289,9 @@
         if (hasPrerequisites(appDesc)) {
             return create(appDesc, true);
         }
+        // Purge bits off disk if we don't have prerequisites to allow app to be
+        // reinstalled later
+        purgeApplication(appDesc.name());
         throw new ApplicationException("Missing dependencies for app " + appDesc.name());
     }