Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
badra001 committed Jan 2, 2026
1 parent 00b164c commit b6f4e29
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions local-app/python-tools/cross-organization/org_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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"])
Expand All @@ -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,
Expand Down

0 comments on commit b6f4e29

Please sign in to comment.