elog-gen.py: handle absence of metadata
An error may just want to inherit metadata from another error, without
adding metadata of it's own. In such a case, the metadata file won't
have the "meta" keyword, although it will have the "inherits" keyword.
Accept metadata files that don't have the "meta" keyword.
Change-Id: I4e30e035f19d6af8e0e1f654465d109fe5284a1b
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/tools/elog-gen.py b/tools/elog-gen.py
index 0452489..469248f 100755
--- a/tools/elog-gen.py
+++ b/tools/elog-gen.py
@@ -214,14 +214,15 @@
error_lvl[fullname] = "INFO"
tmp_meta = []
# grab all the meta data fields and info
- for j in i['meta']:
- str_short = j['str'].split('=')[0]
- tmp_meta.append(str_short)
- meta_data[str_short] = {}
- meta_data[str_short]['str'] = j['str']
- meta_data[str_short]['str_short'] = str_short
- meta_data[str_short]['type'] = get_cpp_type(j['type'])
- meta[fullname] = tmp_meta
+ if('meta' in i):
+ for j in i['meta']:
+ str_short = j['str'].split('=')[0]
+ tmp_meta.append(str_short)
+ meta_data[str_short] = {}
+ meta_data[str_short]['str'] = j['str']
+ meta_data[str_short]['str_short'] = str_short
+ meta_data[str_short]['type'] = get_cpp_type(j['type'])
+ meta[fullname] = tmp_meta
# Debug
# for i in errors: