From 749f88c0715da82626f465877de071704e53e10f Mon Sep 17 00:00:00 2001 From: Maxime Noel Date: Tue, 17 Sep 2024 12:59:10 +0200 Subject: [PATCH] put back filter lines into parameter. --- terracumber/tf_module_cleaner.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/terracumber/tf_module_cleaner.py b/terracumber/tf_module_cleaner.py index db2b0d4..b6aaedf 100644 --- a/terracumber/tf_module_cleaner.py +++ b/terracumber/tf_module_cleaner.py @@ -71,7 +71,12 @@ def filter_module_references(maintf_content, tf_resources_to_keep): def remove_unselected_tf_resources(maintf_file, tf_resources_to_keep, tf_resources_to_delete): with open(maintf_file, 'r') as file: raw_data = file.read() - filtered_lines = [line for line in raw_data if not line.lstrip().startswith("//")] +# filtered_lines = [line for line in raw_data if not line.lstrip().startswith("//")] + for line in raw_data: + if not line.startswith("//"): + filtered_lines = line + else: + logger.info(f"Remove comment line : {line}") data = ''.join(filtered_lines) logger.info(f"Remove comments : {data}") modules = data.split("module ")