diff options
author | Matt Spinler <spinler@us.ibm.com> | 2018-06-13 09:54:13 -0500 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2018-06-13 10:00:56 -0500 |
commit | b2f253b79477745a9b7ddbe9e8ad036109335854 (patch) | |
tree | d3bbb097018ab8e74d83d6f4b61d7e1d1d80a6ba | |
parent | f865645fb08f19090682bf041aaa980191c0b4da (diff) | |
download | phosphor-led-manager-b2f253b79477745a9b7ddbe9e8ad036109335854.tar.gz phosphor-led-manager-b2f253b79477745a9b7ddbe9e8ad036109335854.zip |
Fix fault-monitor interfacesAdded msg parsing
With the latest sdbusplus exception handling changes,
an exception was being thrown when trying to read a pair
out of the interfacesAdded signal message.
Change the code to read the path and map separately.
Also modified the name of the data structures to match
what the message actually returned.
Tested: The exception journal entries went away and LEDs
will turn on and off again.
Change-Id: I2c72000e0da365743715da966a0c9e571efd33d5
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r-- | fault-monitor/fru-fault-monitor.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/fault-monitor/fru-fault-monitor.cpp b/fault-monitor/fru-fault-monitor.cpp index 363cabc..431a7f4 100644 --- a/fault-monitor/fru-fault-monitor.cpp +++ b/fault-monitor/fru-fault-monitor.cpp @@ -31,11 +31,10 @@ constexpr auto LOG_IFACE = "xyz.openbmc_project.Logging.Entry"; using AssociationList = std::vector<std::tuple< std::string, std::string, std::string>>; using Attributes = sdbusplus::message::variant<bool,AssociationList>; -using AttributeName = std::string; -using AttributeMap = std::map<AttributeName, Attributes>; using PropertyName = std::string; -using PropertyMap = std::map<PropertyName, AttributeMap>; -using LogEntryMsg = std::pair<sdbusplus::message::object_path, PropertyMap>; +using PropertyMap = std::map<PropertyName, Attributes>; +using InterfaceName = std::string; +using InterfaceMap = std::map<InterfaceName, PropertyMap>; using Service = std::string; using Path = std::string; @@ -153,10 +152,11 @@ void Add::created(sdbusplus::message::message& msg) { auto bus = msg.get_bus(); - LogEntryMsg logEntry; + sdbusplus::message::object_path objectPath; + InterfaceMap interfaces; try { - msg.read(logEntry); + msg.read(objectPath, interfaces); } catch (const sdbusplus::exception::SdBusError& e) { @@ -165,23 +165,22 @@ void Add::created(sdbusplus::message::message& msg) entry("REPLY_SIG=%s", msg.get_signature())); return; } - std::string objectPath(std::move(logEntry.first)); - std::size_t found = objectPath.find(ELOG_ENTRY); + std::size_t found = objectPath.str.find(ELOG_ENTRY); if (found == std::string::npos) { //Not a new error entry skip return; } - auto iter = logEntry.second.find("org.openbmc.Associations"); - if (iter == logEntry.second.end()) + auto iter = interfaces.find("org.openbmc.Associations"); + if (iter == interfaces.end()) { return; } //Nothing else shows when a specific error log //has been created. Do it here. - std::string message{objectPath + " created"}; + std::string message{objectPath.str + " created"}; log<level::INFO>(message.c_str()); auto attr = iter->second.find("associations"); |