Skip to content

Fix glue error with missing key #109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions terraform/fleet-dashboard/glue-scripts/fleet-dashboard-reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,20 @@ def generate_eks_clusters_details(cluster_details):
with open(
cluster_details_filename, "w", newline="", encoding="utf-8"
) as detailsFile:
fieldnames = list(cluster_addon_data)
# Get all possible fields from all clusters to ensure we capture all addon fields
all_fields = set()
for cluster in cluster_details:
all_fields.update(cluster.keys())

# Convert the set to a sorted list for consistent column ordering
fieldnames = sorted(list(all_fields))

writer = csv.DictWriter(detailsFile, fieldnames=fieldnames)
writer.writeheader()
for cluster in cluster_details:
writer.writerow(cluster)
# Ensure all fields exist in each row, with empty values for missing fields
row = {field: cluster.get(field, '') for field in fieldnames}
writer.writerow(row)

s3_client.upload_file(
cluster_details_filename,
Expand Down