diff --git a/src/spaceone/cost_analysis/manager/config_manager.py b/src/spaceone/cost_analysis/manager/config_manager.py index f732bec..96e60a0 100644 --- a/src/spaceone/cost_analysis/manager/config_manager.py +++ b/src/spaceone/cost_analysis/manager/config_manager.py @@ -71,7 +71,7 @@ def _get_default_unified_cost_config() -> dict: "run_hour": config.get_global("UNIFIED_COST_RUN_HOUR", 0), "aggregation_day": config.get_global("UNIFIED_COST_AGGREGATION_DAY", 15), "is_last_day": False, - "exchange_source": "Yahoo Finance!", + "exchange_source": "Yahoo! Finance", "exchange_date": 15, "is_exchange_last_day": False, "exchange_rate_mode": "AUTO", diff --git a/src/spaceone/cost_analysis/service/cost_query_set_service.py b/src/spaceone/cost_analysis/service/cost_query_set_service.py index 4a881b5..bbd1742 100644 --- a/src/spaceone/cost_analysis/service/cost_query_set_service.py +++ b/src/spaceone/cost_analysis/service/cost_query_set_service.py @@ -1,6 +1,8 @@ import logging from spaceone.core.service import * + +from spaceone.cost_analysis.manager import DataSourceManager from spaceone.cost_analysis.manager.cost_query_set_manager import CostQuerySetManager from spaceone.cost_analysis.model.cost_query_set_model import CostQuerySet @@ -16,6 +18,7 @@ class CostQuerySetService(BaseService): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.data_source_mgr: DataSourceManager = DataSourceManager() self.cost_query_set_mgr: CostQuerySetManager = self.locator.get_manager( "CostQuerySetManager" ) @@ -44,6 +47,14 @@ def create(self, params): cost_query_set_vo (object) """ + domain_id = params["domain_id"] + data_source_id = params["data_source_id"] + + if data_source_id != "unified-cost-data-source": + self.data_source_mgr.get_data_source( + domain_id=domain_id, data_source_id=data_source_id + ) + return self.cost_query_set_mgr.create_cost_query_set(params) @transaction( diff --git a/src/spaceone/cost_analysis/service/unified_cost_service.py b/src/spaceone/cost_analysis/service/unified_cost_service.py index 05a7798..ffb7286 100644 --- a/src/spaceone/cost_analysis/service/unified_cost_service.py +++ b/src/spaceone/cost_analysis/service/unified_cost_service.py @@ -122,7 +122,7 @@ def run_unified_cost(self, params: dict): currency_map, exchange_date = currency_mgr.get_currency_map_date( currency_end_date=exchange_date ) - exchange_source = "Yahoo Finance!" + exchange_source = "Yahoo! Finance" else: currency_map = unified_cost_config["custom_exchange_rate"] exchange_source = unified_cost_config.get("exchange_source", "MANUAL")