image_manager: Delete image dir if same version exists
If the uploaded version already exists, no version D-Bus object
is created, but the directory in /tmp/ with the image files
remain even though there is no use for it, also there is no way for
the user to delete it except rebooting the BMC. This takes up space
and may cause subsequent uploads to fail with out-of-space. Delete
it if the version already exists.
Tested: Uploading the same image deletes the dir in /tmp.
Change-Id: I9518f8132c18c2e7a20e330e8f894caa7bab6236
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/image_manager.cpp b/image_manager.cpp
index f11d124..36ec0bc 100644
--- a/image_manager.cpp
+++ b/image_manager.cpp
@@ -211,6 +211,7 @@
{
log<level::INFO>("Software Object with the same version already exists",
entry("VERSION_ID=%s", id.c_str()));
+ fs::remove_all(imageDirPath);
}
return 0;
}