Create PNOR Functional Association
Created the function updateFunctionalAssociation to update
the functional association for the "running" PNOR image.
This function will be called by the inotify code.
Change-Id: I871624044fbb11800de4d13e6a4b174494c68f13
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/item_updater.cpp b/item_updater.cpp
index 1539f95..d0a3562 100644
--- a/item_updater.cpp
+++ b/item_updater.cpp
@@ -494,11 +494,32 @@
associations(assocs);
}
+void ItemUpdater::updateFunctionalAssociation(const std::string& path)
+{
+ // remove all functional associations
+ for (auto iter = assocs.begin(); iter != assocs.end();)
+ {
+ if ((std::get<0>(*iter)).compare(FUNCTIONAL_FWD_ASSOCIATION) == 0)
+ {
+ iter = assocs.erase(iter);
+ }
+ else
+ {
+ ++iter;
+ }
+ }
+ assocs.emplace_back(std::make_tuple(FUNCTIONAL_FWD_ASSOCIATION,
+ FUNCTIONAL_REV_ASSOCIATION,
+ path));
+ associations(assocs);
+}
+
void ItemUpdater::removeActiveAssociation(std::string path)
{
for (auto iter = assocs.begin(); iter != assocs.end();)
{
- if ((std::get<2>(*iter)).compare(path) == 0)
+ if ((std::get<0>(*iter)).compare(ACTIVE_FWD_ASSOCIATION) == 0 &&
+ (std::get<2>(*iter)).compare(path) == 0)
{
iter = assocs.erase(iter);
associations(assocs);