writefrudata: Reuse ipmi bus for inventory-notify
Partially fixes openbmc/openbmc#875.
Change-Id: Ieaaa65fa8432ffa873dcf2f4f96f9c1e09de3008
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/writefrudata.cpp b/writefrudata.cpp
index 8b59e9a..5c46f5f 100644
--- a/writefrudata.cpp
+++ b/writefrudata.cpp
@@ -445,7 +445,7 @@
// Takes FRU data, invokes Parser for each fru record area and updates
// Inventory
//------------------------------------------------------------------------
-int ipmi_update_inventory(fru_area_vec_t& area_vec)
+int ipmi_update_inventory(fru_area_vec_t& area_vec, sd_bus* bus_sd)
{
// Generic error reporter
int rc = 0;
@@ -474,7 +474,7 @@
// Here we are just printing the object,interface and the properties.
// which needs to be called with the new inventory manager implementation.
- auto bus = sdbusplus::bus::new_default();
+ sdbusplus::bus::bus bus{sd_bus_ref(bus_sd)};
using namespace std::string_literals;
static const auto intf = "xyz.openbmc_project.Inventory.Manager"s;
static const auto path = "/xyz/openbmc_project/inventory"s;
@@ -938,7 +938,7 @@
#ifdef __IPMI_DEBUG__
printf("\n SIZE of vector is : [%d] \n",fru_area_vec.size());
#endif
- rc = ipmi_update_inventory(fru_area_vec);
+ rc = ipmi_update_inventory(fru_area_vec, bus_type);
if(rc <0)
{
fprintf(stderr, "Error updating inventory\n");