log_services: use nlohmann::json::object_t
This updates fillBMCJournalLogEntryJson() and the crashdump logEntry to
use the nlohmann::json::object_t type.
Tested:
Confirmed that the journal and crashdump entries are still displayed
correctly.
Change-Id: Ia940a41aab8e17bac006ee7735b33132e211d5a0
Signed-off-by: Jason M. Bills <jason.m.bills@intel.com>
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 050e7a7..0a16866 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -2103,9 +2103,10 @@
});
}
-static int fillBMCJournalLogEntryJson(const std::string& bmcJournalLogEntryID,
- sd_journal* journal,
- nlohmann::json& bmcJournalLogEntryJson)
+static int
+ fillBMCJournalLogEntryJson(const std::string& bmcJournalLogEntryID,
+ sd_journal* journal,
+ nlohmann::json::object_t& bmcJournalLogEntryJson)
{
// Get the Log Entry contents
int ret = 0;
@@ -2227,14 +2228,14 @@
}
firstEntry = false;
- logEntryArray.push_back({});
- nlohmann::json& bmcJournalLogEntry = logEntryArray.back();
+ nlohmann::json::object_t bmcJournalLogEntry;
if (fillBMCJournalLogEntryJson(idStr, journal.get(),
bmcJournalLogEntry) != 0)
{
messages::internalError(asyncResp->res);
return;
}
+ logEntryArray.push_back(std::move(bmcJournalLogEntry));
}
asyncResp->res.jsonValue["Members@odata.count"] = entryCount;
if (delegatedQuery.skip + delegatedQuery.top < entryCount)
@@ -2307,12 +2308,14 @@
return;
}
+ nlohmann::json::object_t bmcJournalLogEntry;
if (fillBMCJournalLogEntryJson(entryID, journal.get(),
- asyncResp->res.jsonValue) != 0)
+ bmcJournalLogEntry) != 0)
{
messages::internalError(asyncResp->res);
return;
}
+ asyncResp->res.jsonValue = std::move(bmcJournalLogEntry);
});
}
@@ -2774,7 +2777,7 @@
std::string crashdumpURI =
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" +
logID + "/" + filename;
- nlohmann::json logEntry = {
+ nlohmann::json::object_t logEntry = {
{"@odata.type", "#LogEntry.v1_7_0.LogEntry"},
{"@odata.id",
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" +