From b6f4e29b334ef784a00044ae8dfaba18e88b73ac Mon Sep 17 00:00:00 2001 From: badra001 Date: Fri, 2 Jan 2026 10:50:03 -0500 Subject: [PATCH] fix --- .../python-tools/cross-organization/org_runner.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/local-app/python-tools/cross-organization/org_runner.py b/local-app/python-tools/cross-organization/org_runner.py index e2443649..0c227264 100755 --- a/local-app/python-tools/cross-organization/org_runner.py +++ b/local-app/python-tools/cross-organization/org_runner.py @@ -66,7 +66,6 @@ def process_account(self, acc, partition, tasks): "ou_id": ou_id } - # Isolation: Map each module name to its specific result data to prevent overwriting account_results = {"metadata": account_metadata, "task_data": {}} try: @@ -129,9 +128,19 @@ def run(self): if self.args.output: ds = datetime.now().strftime("%Y%m%dT%H%M%S") + # --- RESTORED ACCOUNT BASELINE --- + acc_base = f"audit_results.account.{ds}" + with open(f"{acc_base}.json", 'w') as f: + json.dump([r['metadata'] for r in self.full_results], f, indent=2) + with open(f"{acc_base}.csv", 'w', newline='') as f: + w = csv.DictWriter(f, fieldnames=["org_id", "account_id", "account_name", "alias", "ou_path", "ou_id"]) + w.writeheader() + w.writerows([r['metadata'] for r in self.full_results]) + self.created_files.extend([f"{acc_base}.json", f"{acc_base}.csv"]) + + # --- CHECK SPECIFIC FILES --- for mod_name, _ in tasks: chk_base = f"audit_results.{mod_name}.{ds}" - # Save CSV specifically for THIS module's data with open(f"{chk_base}.csv", 'w', newline='') as f: w = csv.writer(f) w.writerow(["org_id", "account_id", "account_alias", "region", "field_name", "field_value"]) @@ -141,7 +150,6 @@ def run(self): for k, v in fields.items(): w.writerow([self.org_id, res["metadata"]["account_id"], res["metadata"]["alias"], reg, k, v]) - # Save JSON specifically for THIS module's data with open(f"{chk_base}.json", 'w') as f: json.dump([{ "org_id": self.org_id,