From 3cacbc630c7b1042f38feee0667b20c36235fd3b Mon Sep 17 00:00:00 2001 From: Quan Pham Date: Tue, 12 Aug 2025 10:56:25 -0400 Subject: [PATCH] Fix calculate_storage_gb_hours Added timezone awareness to default start and end date arguments. Fixed `s3-bucket-name` cli arguement name. --- .../management/commands/calculate_storage_gb_hours.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py b/src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py index fe11e3b5..45668394 100644 --- a/src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py +++ b/src/coldfront_plugin_cloud/management/commands/calculate_storage_gb_hours.py @@ -146,15 +146,15 @@ def add_arguments(self, parser): @staticmethod def default_start_argument(): - d = (datetime.today() - timedelta(days=1)).replace(day=1) + d = (datetime.now() - timedelta(days=1)).replace(day=1) d = d.replace(hour=0, minute=0, second=0, microsecond=0) - return d + return pytz.utc.localize(d) @staticmethod def default_end_argument(): - d = datetime.today() + d = datetime.now() d = d.replace(hour=0, minute=0, second=0, microsecond=0) - return d + return pytz.utc.localize(d) @staticmethod def upload_to_s3(s3_endpoint, s3_bucket, file_location, invoice_month): @@ -310,7 +310,7 @@ def process_invoice_row(allocation, attrs, su_name, rate): logger.info(f"Uploading to S3 endpoint {options['s3_endpoint_url']}.") self.upload_to_s3( options["s3_endpoint_url"], - options["s3_bucket"], + options["s3_bucket_name"], options["output"], options["invoice_month"], )