entry: switch AdditionalData to dict
Clients have been switched to use AddtionalData2, which is a
dictionary. Move AdditionalData also to a dictionary so we
can stage a removal of AdditionalData2.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I7cc9591895f219471ac098387f72a35c18e6c750
diff --git a/elog_entry.hpp b/elog_entry.hpp
index ccb69a3..185c14e 100644
--- a/elog_entry.hpp
+++ b/elog_entry.hpp
@@ -76,8 +76,8 @@
timestamp(timestampErr, true);
updateTimestamp(timestampErr, true);
message(std::move(msgErr), true);
- additionalData2(std::move(additionalDataErr), true);
- additionalData(util::additional_data::combine(additionalData2()), true);
+ additionalData(std::move(additionalDataErr), true);
+ additionalData2(additionalData(), true);
associations(std::move(objects), true);
// Store a copy of associations in case we need to recreate
assocs = associations();
diff --git a/elog_serialize.cpp b/elog_serialize.cpp
index 6a2dac4..a0f42be 100644
--- a/elog_serialize.cpp
+++ b/elog_serialize.cpp
@@ -108,7 +108,7 @@
e.severity(severity, true);
e.timestamp(timestamp, true);
e.message(message, true);
- e.additionalData(util::additional_data::combine(additionalData), true);
+ e.additionalData(additionalData, true);
e.additionalData2(additionalData, true);
e.sdbusplus::server::xyz::openbmc_project::logging::Entry::resolved(
resolved, true);
diff --git a/log_manager.cpp b/log_manager.cpp
index 7d54e12..b20443f 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -27,6 +27,7 @@
#include <future>
#include <iostream>
#include <map>
+#include <ranges>
#include <set>
#include <string>
#include <string_view>
@@ -308,7 +309,7 @@
bool Manager::isCalloutPresent(const Entry& entry)
{
- for (const auto& c : entry.additionalData())
+ for (const auto& c : std::views::keys(entry.additionalData()))
{
if (c.find("CALLOUT_") != std::string::npos)
{
diff --git a/test/log_manager_dbus_tests.cpp b/test/log_manager_dbus_tests.cpp
index 12136c1..2749e46 100644
--- a/test/log_manager_dbus_tests.cpp
+++ b/test/log_manager_dbus_tests.cpp
@@ -185,21 +185,17 @@
// Extract the NUMBER_OF_LOGS, PID, and CODE_FILE.
for (const auto& value : additionalData)
{
- auto getValue = [&value]() {
- return value.substr(value.find_first_of('=') + 1);
- };
-
- if (value.starts_with("NUMBER_OF_LOGS="))
+ if (value.first == "NUMBER_OF_LOGS")
{
- log_count = getValue();
+ log_count = value.second;
}
- if (value.starts_with("_PID="))
+ if (value.first == "_PID")
{
- pid = std::stoull(getValue());
+ pid = std::stoull(value.second);
}
- if (value.starts_with("_CODE_FILE="))
+ if (value.first == "_CODE_FILE")
{
- source_file = getValue();
+ source_file = value.second;
}
}
}