summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-11-01 10:40:57 -0500
committerMatt Spinler <spinler@us.ibm.com>2017-11-14 11:14:53 -0600
commitf55c1eed445c28d3e666223cecbcde759b0cfb0e (patch)
tree35229e0e3fce7eea175ba001035eac35fd915fbd
parent4eaa77b3f688658d1f1d6a6e95a60a69e8aa83e4 (diff)
downloadphosphor-dbus-monitor-f55c1eed445c28d3e666223cecbcde759b0cfb0e.zip
phosphor-dbus-monitor-f55c1eed445c28d3e666223cecbcde759b0cfb0e.tar.gz
Set Resolved property on elog entry
Fill in the function that sets the Resolved property on an error log entry. Change-Id: I78b57c413a7047508b7fc95e0cf27e1ae6e871cf Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r--src/resolve_errors.cpp40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/resolve_errors.cpp b/src/resolve_errors.cpp
index 6f3c4be..67f7313 100644
--- a/src/resolve_errors.cpp
+++ b/src/resolve_errors.cpp
@@ -24,9 +24,11 @@ namespace dbus
namespace monitoring
{
+constexpr auto LOGGING_IFACE = "xyz.openbmc_project.Logging.Entry";
constexpr auto PROPERTY_IFACE = "org.freedesktop.DBus.Properties";
constexpr auto ASSOCIATION_IFACE = "org.openbmc.Association";
constexpr auto ENDPOINTS_PROPERTY = "endpoints";
+constexpr auto RESOLVED_PROPERTY = "Resolved";
using namespace phosphor::logging;
using EndpointList = std::vector<std::string>;
@@ -79,7 +81,43 @@ void ResolveCallout::operator()()
void ResolveCallout::resolve(const std::string& logEntry)
{
- //TODO: fill in
+ try
+ {
+ static std::string busName;
+ if (busName.empty())
+ {
+ busName = SDBusPlus::getBusName(logEntry, LOGGING_IFACE);
+ if (busName.empty())
+ {
+ return;
+ }
+ }
+
+ sdbusplus::message::variant<bool> resolved = true;
+
+ auto response = SDBusPlus::callMethod(
+ busName,
+ logEntry,
+ PROPERTY_IFACE,
+ "Set",
+ LOGGING_IFACE,
+ RESOLVED_PROPERTY,
+ resolved);
+
+ if (response.is_method_error())
+ {
+ log<level::ERR>(
+ "Failed to set Resolved property on an error log entry",
+ entry("ENTRY=%s", logEntry.c_str()));
+ }
+ }
+ catch (const std::exception& e)
+ {
+ log<level::ERR>(
+ "Unable to resolve error log entry",
+ entry("ENTRY=%s", logEntry.c_str()),
+ entry("MESSAGE=%s", e.what()));
+ }
}
} // namespace monitoring
OpenPOWER on IntegriCloud