Remove adding parent's presence for child FRUs
In the existing code, vpd-tool emplaces the parent FRU's presence for
child FRU whose "Present" property is not available on d-bus. This
gives a misleading information on presence state of non embedded FRU's,
which can either be present or absent on a machine.
Fix:
This commit modifies the vpd-tool code to print "Unknown" if the FRU's
Present property is not available on d-bus.
Test:
1. When Present property is not published on d-bus
vpd-tool -o -O /system/chassis/motherboard/powersupply0
[
{
"/system/chassis/motherboard/powersupply0": {
"LocationCode": "U78DA.ND0.WZS0065-E0",
"Present": "Unknown",
"TYPE": "FRU",
"type": "xyz.openbmc_project.Inventory.Item.PowerSupply"
}
}
]
2. When Present property is set to true on dbus
:~# vpd-tool -o -O /system/chassis/motherboard/powersupply0
[
{
"/system/chassis/motherboard/powersupply0": {
"CC": "51DA",
"DR": "IBM PS",
"FN": "03FP221",
"LocationCode": "U780C.ND0.RCH0014-E0",
"PN": "03FP207",
"Present": "true",
"SN": "YL31KY12K0CX",
"TYPE": "FRU",
"type": "xyz.openbmc_project.Inventory.Item.PowerSupply"
}
}
]
3. When Present property is set to false on dbus
:~# vpd-tool -o -O /system/chassis/motherboard/powersupply0
[
{
"/system/chassis/motherboard/powersupply0": {
"CC": "51DA",
"DR": "IBM PS",
"FN": "03FP221",
"LocationCode": "U780C.ND0.RCH0014-E0",
"PN": "03FP207",
"Present": "false",
"SN": "YL31KY12K0CX",
"TYPE": "FRU",
"type": "xyz.openbmc_project.Inventory.Item.PowerSupply"
}
}
]
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
Change-Id: I4c8ce2141b9ae7c46f1421c59de5d627b8aad429
diff --git a/vpd_tool_impl.hpp b/vpd_tool_impl.hpp
index 669232a..16c3a34 100644
--- a/vpd_tool_impl.hpp
+++ b/vpd_tool_impl.hpp
@@ -132,11 +132,9 @@
/**
* @brief Get the json which has Present property value of the given fru.
* @param[in] invPath - inventory path of the fru.
- * @param[out] parentPresence - Update the parent fru's present property.
* @return output json which has the Present property value.
*/
- json getPresentPropJson(const std::string& invPath,
- std::string& parentPresence);
+ json getPresentPropJson(const std::string& invPath);
/**
* @brief Parse through the options to fix system VPD