diff options
author | Leonel Gonzalez <lgonzalez@us.ibm.com> | 2017-07-07 14:38:25 -0500 |
---|---|---|
committer | Leonel Gonzalez <lgonzalez@us.ibm.com> | 2017-07-26 15:34:13 -0500 |
commit | 50d559c9bff3c873ef102f460819cedea64d6963 (patch) | |
tree | c0c585967b175a600cb6d1aa07f62ddeb0097e2f /image_manager.cpp | |
parent | e42336874f7f0b733ed392eb3e5c7e41ad3f7768 (diff) | |
download | phosphor-bmc-code-mgmt-50d559c9bff3c873ef102f460819cedea64d6963.tar.gz phosphor-bmc-code-mgmt-50d559c9bff3c873ef102f460819cedea64d6963.zip |
image_manager: Added erase method
Image manager deletes image, image directory,
and the version from its map.
Change-Id: Ica128927b706257eb8c4b28d3b9d2ac9ca397b91
Signed-off-by: Leonel Gonzalez <lgonzalez@us.ibm.com>
Diffstat (limited to 'image_manager.cpp')
-rw-r--r-- | image_manager.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/image_manager.cpp b/image_manager.cpp index eaf2e6d..bc9ce9e 100644 --- a/image_manager.cpp +++ b/image_manager.cpp @@ -177,6 +177,22 @@ int Manager::processImage(const std::string& tarFilePath) return 0; } +void Manager::erase(std::string entryId) +{ + auto it = versions.find(entryId); + if (it == versions.end()) + { + return; + } + // Delete image dir + fs::path imageDirPath = (*(it->second)).path(); + if (fs::exists(imageDirPath)) + { + fs::remove_all(imageDirPath); + } + this->versions.erase(entryId); +} + int Manager::unTar(const std::string& tarFilePath, const std::string& extractDirPath) { |