peltool: Add Notes from message registry file
Add the Notes section found in the message registry file to the json
output (if it's present and not empty).
Example:
"Error Details": {
"Message": "Unknown (Original event not in message registry)",
"Notes": [
"This is used when the actual error name isn't",
"found in the registry."
]
}
Signed-off-by: Harisuddin Mohamed Isa <harisuddin@gmail.com>
Change-Id: I69773547c06f6361055c2f0decd07967d0012946
diff --git a/extensions/openpower-pels/registry.cpp b/extensions/openpower-pels/registry.cpp
index c8c37f9..523a15b 100644
--- a/extensions/openpower-pels/registry.cpp
+++ b/extensions/openpower-pels/registry.cpp
@@ -680,7 +680,12 @@
entry.doc.description = doc["Description"];
if (doc.contains("MessageArgSources"))
{
- entry.doc.messageArgSources = doc["MessageArgSources"];
+ entry.doc.messageArgSources =
+ doc["MessageArgSources"].get<std::vector<std::string>>();
+ }
+ if (doc.contains("Notes") && !doc["Notes"].empty())
+ {
+ entry.doc.notes = doc["Notes"].get<std::vector<std::string>>();
}
// If there are callouts defined, save the JSON for later
diff --git a/extensions/openpower-pels/registry.hpp b/extensions/openpower-pels/registry.hpp
index c3b3bc0..0314081 100644
--- a/extensions/openpower-pels/registry.hpp
+++ b/extensions/openpower-pels/registry.hpp
@@ -59,6 +59,11 @@
* in the Message field.
*/
std::optional<std::vector<std::string>> messageArgSources;
+
+ /**
+ * @brief An optional vector of string that forms the Notes field.
+ */
+ std::optional<std::vector<std::string>> notes;
};
/**
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index 19d140d..7e764bb 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -503,6 +503,10 @@
jsonInsert(errorOut, "Message", errorMsg.value(), 2);
}
}
+ if (entry->doc.notes)
+ {
+ jsonInsertArray(errorOut, "Notes", entry->doc.notes.value(), 2);
+ }
if (entry->src.hexwordADFields)
{
std::map<size_t, std::tuple<std::string, std::string>>