From 991af7ecfb579e72613b6c2ab5036a4dc7834636 Mon Sep 17 00:00:00 2001 From: Adriana Kobylak Date: Mon, 10 Dec 2018 13:08:38 -0600 Subject: item_updater: Call remove association on delete The remove association function was supposed to be called on delete but was never implemented so if the associations are queried but the version has been deleted, that'd be false information, so call to remove the associations on delete, also rename it to delete all associations, because the delete function already determined if the requested version is functional. Tested: Verified the associations for the requested version are deleted with a DeleteAll and Delete call. Change-Id: Ia4fde01c9500b648660bc9a4c355d44a35af7cc5 Signed-off-by: Adriana Kobylak --- item_updater.cpp | 8 +++----- item_updater.hpp | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/item_updater.cpp b/item_updater.cpp index 6dd7a52..173ee29 100644 --- a/item_updater.cpp +++ b/item_updater.cpp @@ -324,6 +324,7 @@ void ItemUpdater::erase(std::string entryId) } else { + removeAssociations(ita->second->path); this->activations.erase(entryId); } ItemUpdater::resetUbootEnvVars(); @@ -520,14 +521,11 @@ void ItemUpdater::createFunctionalAssociation(const std::string& path) associations(assocs); } -void ItemUpdater::removeActiveAssociation(const std::string& path) +void ItemUpdater::removeAssociations(const std::string& path) { for (auto iter = assocs.begin(); iter != assocs.end();) { - // Since there could be multiple associations to the same path, - // only remove ones that have an active forward association. - if ((std::get<0>(*iter)).compare(ACTIVE_FWD_ASSOCIATION) == 0 && - (std::get<2>(*iter)).compare(path) == 0) + if ((std::get<2>(*iter)).compare(path) == 0) { iter = assocs.erase(iter); associations(assocs); diff --git a/item_updater.hpp b/item_updater.hpp index ac966ca..aafd66b 100644 --- a/item_updater.hpp +++ b/item_updater.hpp @@ -106,11 +106,11 @@ class ItemUpdater : public ItemUpdaterInherit */ void createActiveAssociation(const std::string& path); - /** @brief Removes an active association to the software image + /** @brief Removes the associations from the provided software image path * - * @param[in] path - The path to remove the association from. + * @param[in] path - The path to remove the associations from. */ - void removeActiveAssociation(const std::string& path); + void removeAssociations(const std::string& path); /** @brief Determine if the given priority is the lowest * -- cgit v1.2.1