|
2 | 2 | Merges metrics from files and produces reports by pod and by namespace
|
3 | 3 | """
|
4 | 4 |
|
| 5 | +import os |
5 | 6 | import argparse
|
6 | 7 | from datetime import datetime, UTC
|
7 | 8 | import json
|
@@ -145,23 +146,24 @@ def main():
|
145 | 146 | utils.write_metrics_by_pod(condensed_metrics_dict, pod_report_file, ignore_hours)
|
146 | 147 |
|
147 | 148 | if args.upload_to_s3:
|
| 149 | + bucket_name = os.environ.get("S3_INVOICE_BUCKET", "nerc-invoicing") |
148 | 150 | primary_location = (
|
149 | 151 | f"Invoices/{report_month}/"
|
150 | 152 | f"Service Invoices/NERC OpenShift {report_month}.csv"
|
151 | 153 | )
|
152 |
| - utils.upload_to_s3(invoice_file, "nerc-invoicing", primary_location) |
| 154 | + utils.upload_to_s3(invoice_file, bucket_name, primary_location) |
153 | 155 |
|
154 | 156 | timestamp = datetime.utcnow().strftime('%Y%m%dT%H%M%SZ')
|
155 | 157 | secondary_location = (
|
156 | 158 | f"Invoices/{report_month}/"
|
157 | 159 | f"Archive/NERC OpenShift {report_month} {timestamp}.csv"
|
158 | 160 | )
|
159 |
| - utils.upload_to_s3(invoice_file, "nerc-invoicing", secondary_location) |
| 161 | + utils.upload_to_s3(invoice_file, bucket_name, secondary_location) |
160 | 162 | pod_report_location = (
|
161 | 163 | f"Invoices/{report_month}/"
|
162 | 164 | f"Archive/Pod-NERC OpenShift {report_month} {timestamp}.csv"
|
163 | 165 | )
|
164 |
| - utils.upload_to_s3(pod_report_file, "nerc-invoicing", pod_report_location) |
| 166 | + utils.upload_to_s3(pod_report_file, bucket_name, pod_report_location) |
165 | 167 |
|
166 | 168 | if __name__ == "__main__":
|
167 | 169 | main()
|
0 commit comments