From 554d41bccac14532cbc667e357bd1a06b93335d2 Mon Sep 17 00:00:00 2001 From: jizhuoyu <44009608+jizhuoyu@users.noreply.github.com> Date: Tue, 24 Oct 2023 10:36:23 -0400 Subject: [PATCH] Adapt fix_template.py to work with new directory structure under dashboards (#25) Adapt `fix_template.py` to work with new directory structure under `dashboards` --- scripts/fix_template.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/fix_template.py b/scripts/fix_template.py index 7001ed6..a109098 100755 --- a/scripts/fix_template.py +++ b/scripts/fix_template.py @@ -29,12 +29,12 @@ def main(argv): sys.exit() elif opt in ("-d", "--directory"): directory = arg - deployment_types = next(walk(directory), (None, None, []))[1] - parms = [] - for dpt in deployment_types: - filenames = next(walk(f"{directory}/{dpt}"), (None, None, []))[2] - dpt_parms = [f"{directory}/{dpt}/{f}" for f in filenames] - parms.extend(dpt_parms) + # Directly get filenames in the specified directory + filenames = next(walk(directory), (None, None, []))[2] + # Filter out only JSON files (assuming all dashboard files are JSON) + json_files = [f for f in filenames if f.endswith('.json')] + # Construct the full paths for these files + parms = [os.path.join(directory, f) for f in json_files] for p in parms: remove_selected_text(p) print("============= Dashboards are valid now ==============")