Copy record data from parent FRU
This commit implement changes to copy record(s) data from
parent FRU if "copyRecords" array is set for the child FRU
in Json.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: If1207daa73fb88f5c988d48418dc672a4277927d
diff --git a/vpd-manager/editor_impl.cpp b/vpd-manager/editor_impl.cpp
index 1b9290d..57fed60 100644
--- a/vpd-manager/editor_impl.cpp
+++ b/vpd-manager/editor_impl.cpp
@@ -433,6 +433,24 @@
singleInventory["inventoryPath"]
.get_ref<const nlohmann::json::string_t&>());
}
+
+ // check if we need to copy some specific records in this case.
+ if (singleInventory.find("copyRecords") != singleInventory.end())
+ {
+ if (find(singleInventory["copyRecords"].begin(),
+ singleInventory["copyRecords"].end(),
+ thisRecord.recName) !=
+ singleInventory["copyRecords"].end())
+ {
+ prop.emplace(thisRecord.recKWd, thisRecord.kwdUpdatedData);
+ interfaces.emplace(
+ (IPZ_INTERFACE + std::string{"."} + thisRecord.recName),
+ move(prop));
+ objects.emplace(
+ (singleInventory["inventoryPath"].get<std::string>()),
+ move(interfaces));
+ }
+ }
}
// Notify PIM
common::utility::callPIM(move(objects));