item_updater : erase() : remove uploaded images

This method needs to erase both uploaded and active images
to ensure that after either the Delete or DeleteAll methods are
called, all targeted images are removed regardless of activation
status and the necessary space is freed up. Erase should also handle
the deleting of images from the image manager to ensure that--after
deletion--the same image can then be uploaded without receiving the
"image already exists" message.

Tested: Used busctl to call the delete method. Ensured that the
same image can then be uploaded again without reboot. Ensured that
the tmp/images/ directory was empty.

Signed-off-by: Zami Seck <zimzam17@gmail.com>
Change-Id: I3ebec1f4bd9dfcf406afa22f958621ed56eca9b1
diff --git a/activation.cpp b/activation.cpp
index 6029f33..c90b537 100644
--- a/activation.cpp
+++ b/activation.cpp
@@ -418,9 +418,6 @@
 
         if (newStateResult == "done")
         {
-            // Remove version object from image manager
-            deleteImageManagerObject();
-
             // Set activation progress to 100
             activationProgress->progress(100);
 
diff --git a/item_updater.cpp b/item_updater.cpp
index b6464f6..fe9c808 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -363,6 +363,7 @@
     else
     {
         removeAssociations(iteratorActivations->second->path);
+        iteratorActivations->second->deleteImageManagerObject();
         this->activations.erase(entryId);
     }
     ItemUpdater::resetUbootEnvVars();