diff options
author | Matthew Barth <msbarth@us.ibm.com> | 2018-05-10 11:39:46 -0500 |
---|---|---|
committer | Matthew Barth <msbarth@us.ibm.com> | 2018-05-17 12:13:36 -0500 |
commit | 17792cda3aa968116998391ef0982d7a9989c8da (patch) | |
tree | b1466b3ba8b9bb15916bcf3b8f15a58b1958ef8e /cooling-type/cooling_type.cpp | |
parent | 26e96122ee89ccaa2de317deb70af5dc5011f48f (diff) | |
download | phosphor-fan-presence-17792cda3aa968116998391ef0982d7a9989c8da.tar.gz phosphor-fan-presence-17792cda3aa968116998391ef0982d7a9989c8da.zip |
cooling-type: Use lookupAndCallMethod
Have phosphor-cooling-type fail with a DBusMethodError exception when a
failure occurs on updating inventory.
Resolves: openbmc/openbmc#2628
Tested:
Cooling type properties still set correctly
Change-Id: Ia7e3379fc7d75c70e9c71d4f940f9da84b9f5774
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'cooling-type/cooling_type.cpp')
-rw-r--r-- | cooling-type/cooling_type.cpp | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/cooling-type/cooling_type.cpp b/cooling-type/cooling_type.cpp index 3cb19ab..a1c4748 100644 --- a/cooling-type/cooling_type.cpp +++ b/cooling-type/cooling_type.cpp @@ -8,6 +8,7 @@ #include <libevdev/libevdev.h> #include "utility.hpp" #include "cooling_type.hpp" +#include "sdbusplus.hpp" namespace phosphor { @@ -94,27 +95,17 @@ CoolingType::ObjectMap CoolingType::getObjectMap(const std::string& objpath) void CoolingType::updateInventory(const std::string& objpath) { - using namespace phosphor::logging; + using namespace phosphor::fan; ObjectMap invObj = getObjectMap(objpath); - std::string invService; - - invService = phosphor::fan::util::getInvService(bus); - // Update inventory - auto invMsg = bus.new_method_call(invService.c_str(), - INVENTORY_PATH, - INVENTORY_INTF, - "Notify"); - invMsg.append(std::move(invObj)); - auto invMgrResponseMsg = bus.call(invMsg); - if (invMgrResponseMsg.is_method_error()) - { - log<level::ERR>( - "Error in inventory manager call to update inventory"); - elog<InternalFailure>(); - } + auto invMgrResponseMsg = util::SDBusPlus::lookupAndCallMethod( + bus, + util::INVENTORY_PATH, + util::INVENTORY_INTF, + "Notify", + std::move(invObj)); } } |