elog-gen.py: Support subdirs
Add ability for elog-gen.py to find yaml files under subdirectories
so that yaml files found in Error/Callout/ and Error/IIC/ for
example can be found by the caller just passing the Error/ directory.
Change-Id: I91dcd523d2a75deea6266a3ea6885b88cd788206
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/tools/elog-gen.py b/tools/elog-gen.py
index 168e1fd..fe4807e 100755
--- a/tools/elog-gen.py
+++ b/tools/elog-gen.py
@@ -57,9 +57,10 @@
def get_error_yaml_files(i_yaml_dir):
- yaml_files = filter(
- lambda file: file.endswith('.errors.yaml'),
- os.listdir(i_yaml_dir))
+ yaml_files = []
+ for root, dirs, files in os.walk(i_yaml_dir):
+ for files in filter(lambda file: file.endswith('.errors.yaml'), files):
+ yaml_files.append(os.path.join(root, files))
return yaml_files
@@ -110,7 +111,6 @@
for error_yaml in error_yamls:
# Verify the error yaml file
- error_yaml = "/".join((i_yaml_dir, error_yaml))
if (not (os.path.isfile(error_yaml))):
print("Can not find input yaml file " + error_yaml)
exit(1)