summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMatthew Barth <msbarth@us.ibm.com>2019-08-12 15:22:01 -0500
committerMatthew Barth <msbarth@us.ibm.com>2019-08-12 15:22:01 -0500
commit19fe323b6a36950af43058694e91457cc64dd709 (patch)
tree7c3e7da9714d8ad61180737154dac6c138ceb96b /tools
parentc19ea653881781c9879a6b51c63989825dc80c2c (diff)
downloadphosphor-logging-19fe323b6a36950af43058694e91457cc64dd709.tar.gz
phosphor-logging-19fe323b6a36950af43058694e91457cc64dd709.zip
Remove empty entries in elog lookup meta data
A journal entry is produced for failure to find empty string meta data for elogs due to an empty string entry within the generated elog lookup source. This empty string is due to error yamls that do not contain any meta data entry of their own and only inherit from another error yaml. An example of the journal entry for the empty string meta data that is removed with this fix:: CODE_LINE=76 CODE_FUNC=helper_log _SYSTEMD_SLICE=system.slice CODE_FILE=../git/phosphor-logging/log.hpp MESSAGE=Failed to find metadata TRANSACTION_ID=4016514682 META_FIELD= SYSLOG_IDENTIFIER=phosphor-log-manager _PID=181 _COMM=phosphor-log-ma _EXE=/usr/bin/phosphor-log-manager Tested: Built image and verified empty string entry no longer generated on errors without meta data but inherit meta data from other error yaml Change-Id: I3c8745acd86173873827cd59eb6e8d4f687b0e1b Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/phosphor-logging/templates/elog-lookup-template.mako.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp
index e29b7a9..c9361d8 100644
--- a/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp
+++ b/tools/phosphor-logging/templates/elog-lookup-template.mako.cpp
@@ -16,18 +16,20 @@ namespace logging
const std::map<std::string,std::vector<std::string>> g_errMetaMap = {
% for name in errors:
<%
+ meta_string = ""
meta_list = []
- if(name in meta):
+ if(name in meta and meta[name]):
meta_list = meta[name]
- meta_string = '\",\"'.join(meta_list)
+ meta_string = '\",\"'.join(meta_list)
parent = parents[name]
while parent:
- tmpparent = parent.split('.')
- ## Name is the last item
- parent_name = tmpparent[-1]
- parent_meta_short = '\",\"'.join(meta[parent])
- meta_string = meta_string + "\",\"" + parent_meta_short
+ if (parent in meta and meta[parent]):
+ parent_meta_short = '\",\"'.join(meta[parent])
+ if (meta_string):
+ meta_string = meta_string + "\",\"" + parent_meta_short
+ else:
+ meta_string = parent_meta_short
parent = parents[parent]
if ("example.xyz.openbmc_project" not in name):
index = name.rfind('.')
OpenPOWER on IntegriCloud