summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-06-12 16:42:33 -0700
committerWilliam A. Kennington III <wak@google.com>2018-06-12 16:53:21 -0700
commit90d147a1ee5340278506bbdf94edc32bb77154f2 (patch)
treebd60788e13dea94b348236f156be3bc51c1d9e30
parent15cd3ce7045fb4da18c0b9dc89772d9807490a54 (diff)
downloadphosphor-debug-collector-90d147a1ee5340278506bbdf94edc32bb77154f2.tar.gz
phosphor-debug-collector-90d147a1ee5340278506bbdf94edc32bb77154f2.zip
elog_watch: Fix parsing of elog add requests
Requests come in the form "oa{sa{sv}}". However, the way sdbusplus was interpreting the type of our message "a{oa{sa{sv}}}" since tuples are not allowed to consume multiple arguments during the read call as that would be ambiguous. This fixes the type issues. Prior to the change to sdbusplus that introduces error handling for the read calls, the sd_bus_message_{enter,exit}_container were failing during the read on the pair. Luckily this produces the expected result for the read and our old code was "working". This also cleans up an unnecessary string move. Tested: Builds and no longer produces errors on zaius when elogs are added. Change-Id: Ifc5394f3f361e8932c939376bd0bf5b4e3ca589c Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r--elog_watch.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/elog_watch.cpp b/elog_watch.cpp
index e2a3866..6817f8b 100644
--- a/elog_watch.cpp
+++ b/elog_watch.cpp
@@ -28,7 +28,6 @@ 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>;
Watch::Watch(sdbusplus::bus::bus& bus, IMgr& iMgr):
iMgr(iMgr),
@@ -65,10 +64,11 @@ void Watch::addCallback(sdbusplus::message::message& msg)
using QuotaExceeded =
sdbusplus::xyz::openbmc_project::Dump::Create::Error::QuotaExceeded;
- LogEntryMsg logEntry;
+ sdbusplus::message::object_path objectPath;
+ PropertyMap propertyMap;
try
{
- msg.read(logEntry);
+ msg.read(objectPath, propertyMap);
}
catch (const sdbusplus::exception::SdBusError& e)
{
@@ -78,9 +78,7 @@ void Watch::addCallback(sdbusplus::message::message& msg)
return;
}
- std::string objectPath(std::move(logEntry.first));
-
- std::size_t found = objectPath.find("entry");
+ std::size_t found = objectPath.str.find("entry");
if (found == std::string::npos)
{
//Not a new error entry skip
@@ -96,8 +94,8 @@ void Watch::addCallback(sdbusplus::message::message& msg)
return;
}
- auto iter = logEntry.second.find("xyz.openbmc_project.Logging.Entry");
- if (iter == logEntry.second.end())
+ auto iter = propertyMap.find("xyz.openbmc_project.Logging.Entry");
+ if (iter == propertyMap.end())
{
return;
}
@@ -145,10 +143,10 @@ void Watch::addCallback(sdbusplus::message::message& msg)
void Watch::delCallback(sdbusplus::message::message& msg)
{
- sdbusplus::message::object_path logEntry;
+ sdbusplus::message::object_path objectPath;
try
{
- msg.read(logEntry);
+ msg.read(objectPath);
}
catch (const sdbusplus::exception::SdBusError& e)
{
@@ -158,9 +156,6 @@ void Watch::delCallback(sdbusplus::message::message& msg)
return;
}
- //Get elog entry message string.
- std::string objectPath(logEntry);
-
//Get elog id
auto eId = getEid(objectPath);
OpenPOWER on IntegriCloud