elog-gen.py : get inherited-from error
Openbmc error interfaces can inherit other error interfaces, thereby
allowing to combine metadata across errors. The current implementation
would support single inheritance only.
This first commit related to error inheritance implementation lets
elog-gen.py figure out an error's parent.
Change-Id: Ia5c44de755e777e0cb2725afa5988c97283d10f0
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/tools/elog-gen.py b/tools/elog-gen.py
index d10c026..88e46c8 100755
--- a/tools/elog-gen.py
+++ b/tools/elog-gen.py
@@ -66,6 +66,7 @@
error_lvl = dict() # Error code log level (debug, info, error, ...)
meta = list() # The meta data names associated (ERRNO, FILE_NAME, ...)
meta_data = dict() # The meta data info (type, format)
+ parents = list()
error_yamls = get_error_yaml_files(i_yaml_dir)
@@ -95,7 +96,8 @@
error_msg,
error_lvl,
meta,
- meta_data))
+ meta_data,
+ parents))
# Load the mako template and call it with the required data
yaml_dir = i_yaml_dir.strip("./")
@@ -121,7 +123,7 @@
i_elog_meta_yaml metadata yaml file
o_elog_data error metadata
"""
- errors, error_msg, error_lvl, meta, meta_data = o_elog_data
+ errors, error_msg, error_lvl, meta, meta_data, parents = o_elog_data
ifile = yaml.safe_load(open(i_elog_yaml))
mfile = yaml.safe_load(open(i_elog_meta_yaml))
for i in ifile:
@@ -136,6 +138,12 @@
exit(1)
# Grab the main error and it's info
errors.append(i['name'])
+ parent = None
+ if('inherits' in i):
+ # xyz.openbmc.Foo, we need Foo
+ # Get 0th inherited error (current support - single inheritance)
+ parent = i['inherits'][0].split(".").pop()
+ parents.append(parent)
error_msg[i['name']] = i['description']
error_lvl[i['name']] = match['level']
tmp_meta = []
diff --git a/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml b/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml
index 73fe62b..5ab311f 100644
--- a/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml
+++ b/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml
@@ -1,2 +1,4 @@
- name: Foo
description: this is test error Foo
+ inherits:
+ - example.xyz.openbmc_project.Example.TestErrorOne