Move inherits keyword from errors.yaml to metadata.yaml

The metadata.yaml file is the correct location for the inherits.
Update the elog-gen.py parser to support this change.

Change-Id: Iac7f67ec72e761ab3dafbf89c7e4d5495b34f00d
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/tools/elog-gen.py b/tools/elog-gen.py
index b6fc4fe..168e1fd 100755
--- a/tools/elog-gen.py
+++ b/tools/elog-gen.py
@@ -171,12 +171,12 @@
     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:
+    for i in mfile:
         match = None
         # Find the corresponding meta data for this entry
-        for m in mfile:
-            if m['name'] == i['name']:
-                match = m
+        for j in ifile:
+            if j['name'] == i['name']:
+                match = j
                 break
         if (match is None):
             print("Error - Did not find meta data for " + i['name'])
@@ -189,11 +189,11 @@
             # Get 0th inherited error (current support - single inheritance)
             parent = i['inherits'][0].split(".").pop()
         parents[i['name']] = parent
-        error_msg[i['name']] = i['description']
-        error_lvl[i['name']] = match['level']
+        error_msg[i['name']] = match['description']
+        error_lvl[i['name']] = i['level']
         tmp_meta = []
         # grab all the meta data fields and info
-        for j in match['meta']:
+        for j in i['meta']:
             str_short = j['str'].split('=')[0]
             tmp_meta.append(str_short)
             meta_data[str_short] = {}
diff --git a/tools/example/xyz/openbmc_project/Example/Bar.errors.yaml b/tools/example/xyz/openbmc_project/Example/Bar.errors.yaml
index cff338b..db5fff2 100644
--- a/tools/example/xyz/openbmc_project/Example/Bar.errors.yaml
+++ b/tools/example/xyz/openbmc_project/Example/Bar.errors.yaml
@@ -1,4 +1,2 @@
 - name: Bar
   description: this is test error Bar
-  inherits:
-    - Foo
diff --git a/tools/example/xyz/openbmc_project/Example/Bar.metadata.yaml b/tools/example/xyz/openbmc_project/Example/Bar.metadata.yaml
index ceebffd..bc7381a 100644
--- a/tools/example/xyz/openbmc_project/Example/Bar.metadata.yaml
+++ b/tools/example/xyz/openbmc_project/Example/Bar.metadata.yaml
@@ -3,3 +3,5 @@
   meta:
     - str: "BAR_DATA=%s"
       type: string
+  inherits:
+    - Foo
diff --git a/tools/example/xyz/openbmc_project/Example/Elog.errors.yaml b/tools/example/xyz/openbmc_project/Example/Elog.errors.yaml
index 6f75178..1ec9997 100644
--- a/tools/example/xyz/openbmc_project/Example/Elog.errors.yaml
+++ b/tools/example/xyz/openbmc_project/Example/Elog.errors.yaml
@@ -1,7 +1,5 @@
 - name: TestErrorOne
   description: this is test error one
-  inherits:
-    - TestErrorTwo
 
 - name: TestErrorTwo
   description: This is test error two
diff --git a/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml b/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml
index 244127c..f0838e0 100644
--- a/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml
+++ b/tools/example/xyz/openbmc_project/Example/Elog.metadata.yaml
@@ -7,6 +7,8 @@
       type: string
     - str: FILE_NAME=%s
       type: string
+  inherits:
+    - TestErrorTwo
 
 - name: TestErrorTwo
   level: ERR
diff --git a/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml b/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml
index e81571c..73fe62b 100644
--- a/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml
+++ b/tools/example/xyz/openbmc_project/Example/Foo.errors.yaml
@@ -1,4 +1,2 @@
 - name: Foo
   description: this is test error Foo
-  inherits:
-    - example.xyz.openbmc_project.Example.TestErrorOne
diff --git a/tools/example/xyz/openbmc_project/Example/Foo.metadata.yaml b/tools/example/xyz/openbmc_project/Example/Foo.metadata.yaml
index 2ac0532..02963aa 100644
--- a/tools/example/xyz/openbmc_project/Example/Foo.metadata.yaml
+++ b/tools/example/xyz/openbmc_project/Example/Foo.metadata.yaml
@@ -3,3 +3,5 @@
   meta:
     - str: "FOO_DATA=%s"
       type: string
+  inherits:
+    - example.xyz.openbmc_project.Example.TestErrorOne