flash-bios: Do not delete image in case of failure

The code was to delete the BIOS image after the BIOS code update is
finished no matter if the update is successful or not.

Change the logic to not delete the image when it fails, so that we could
examine what's wrong and retry the update.

To delete the image, use DELETE API.

Tested: Verify the image is not deleted when BIOS code update fails.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: Ic4d985b0e48bc134f710590aa06098b1e15b1c27
diff --git a/activation.cpp b/activation.cpp
index 79b5b10..c82e297 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -418,11 +418,11 @@
         // unsubscribe to systemd signals
         unsubscribeFromSystemdSignals();
 
-        // Remove version object from image manager
-        deleteImageManagerObject();
-
         if (newStateResult == "done")
         {
+            // Remove version object from image manager
+            deleteImageManagerObject();
+
             // Set activation progress to 100
             activationProgress->progress(100);