summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepak Kodihalli <dkodihal@in.ibm.com>2017-01-17 07:59:29 -0600
committerDeepak Kodihalli <dkodihal@in.ibm.com>2017-01-27 10:42:25 -0600
commit82b7de7e3211659a3dd323d7a986cfec7a3751ff (patch)
tree1be606302e72313f8353d1f351ada3178f81e304 /tools
parent160d3e0b810f6c5f582c7daf906ce0c99cd4194e (diff)
downloadphosphor-logging-82b7de7e3211659a3dd323d7a986cfec7a3751ff.tar.gz
phosphor-logging-82b7de7e3211659a3dd323d7a986cfec7a3751ff.zip
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>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/elog-gen.py12
-rw-r--r--tools/example/xyz/openbmc_project/Example/Foo.errors.yaml2
2 files changed, 12 insertions, 2 deletions
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 @@ def gen_elog_hpp(i_yaml_dir, i_output_hpp,
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 @@ def gen_elog_hpp(i_yaml_dir, i_output_hpp,
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 @@ def get_elog_data(i_elog_yaml,
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 @@ def get_elog_data(i_elog_yaml,
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
OpenPOWER on IntegriCloud