From 63982cf78f70bb5ef543fcbb24f080dce2e294ad Mon Sep 17 00:00:00 2001 From: Thirumalesh Aaraveti <97395760+athiruma@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:28:38 +0530 Subject: [PATCH] Fixed some minor bus (#687) --- .../common/abstract_monitor_tickets.py | 2 +- .../cloud_resource_orchestration/common/run_cro.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cloud_governance/cloud_resource_orchestration/common/abstract_monitor_tickets.py b/cloud_governance/cloud_resource_orchestration/common/abstract_monitor_tickets.py index 83553293..df6b93ee 100644 --- a/cloud_governance/cloud_resource_orchestration/common/abstract_monitor_tickets.py +++ b/cloud_governance/cloud_resource_orchestration/common/abstract_monitor_tickets.py @@ -200,7 +200,7 @@ def _monitor_ticket_budget(self, ticket_id: str, region_name: str, budget: int, remaining_budget = budget - used_budget threshold_budget = budget - (budget * (self.__ticket_over_usage_limit / 100)) subject = body = None - if threshold_budget >= remaining_budget: + if threshold_budget >= remaining_budget > 0: ticket_extended = self.extend_tickets_budget(ticket_id=ticket_id, region_name=region_name, current_budget=budget) if not ticket_extended: diff --git a/cloud_governance/cloud_resource_orchestration/common/run_cro.py b/cloud_governance/cloud_resource_orchestration/common/run_cro.py index 43167916..1eb8a603 100644 --- a/cloud_governance/cloud_resource_orchestration/common/run_cro.py +++ b/cloud_governance/cloud_resource_orchestration/common/run_cro.py @@ -17,7 +17,7 @@ class RunCRO: def __init__(self): self.__environment_variables_dict = environment_variables.environment_variables_dict self.__es_operations = ElasticSearchOperations() - self.__account = self.__environment_variables_dict.get('account', '') + self.__account = self.__environment_variables_dict.get('account', '').lower() self.__cloud_name = self.__environment_variables_dict.get('PUBLIC_CLOUD_NAME') self.__cro_object = CroObject(public_cloud_name=self.__cloud_name) self.__cost_over_usage = self.__cro_object.cost_over_usage() @@ -34,10 +34,10 @@ def save_current_timestamp(self): if not self.__es_operations.verify_elastic_index_doc_id(index=self.PERSISTENT_RUN_INDEX, doc_id=self.PERSISTENT_RUN_DOC_ID): self.__es_operations.upload_to_elasticsearch(index=self.PERSISTENT_RUN_INDEX, data={ - f'last_run_{self.__account}': datetime.utcnow()}, id=self.PERSISTENT_RUN_DOC_ID) + f'last_run_{self.__account.lower()}': datetime.utcnow()}, id=self.PERSISTENT_RUN_DOC_ID) else: self.__es_operations.update_elasticsearch_index(index=self.PERSISTENT_RUN_INDEX, - metadata={f'last_run_{self.__account}': datetime.utcnow()}, + metadata={f'last_run_{self.__account.lower()}': datetime.utcnow()}, id=self.PERSISTENT_RUN_DOC_ID) @logger_time_stamp