diff --git a/src/spaceone/cost_analysis/manager/identity_manager.py b/src/spaceone/cost_analysis/manager/identity_manager.py index ab181b11..a063f396 100644 --- a/src/spaceone/cost_analysis/manager/identity_manager.py +++ b/src/spaceone/cost_analysis/manager/identity_manager.py @@ -16,9 +16,12 @@ def __init__(self, *args, **kwargs): ) def check_workspace(self, workspace_id: str, domain_id: str) -> None: + system_token = config.get_global("TOKEN") + self.identity_conn.dispatch( "Workspace.check", {"workspace_id": workspace_id, "domain_id": domain_id}, + token=system_token, ) @cache.cacheable(key="workspace-name:{domain_id}:{workspace_id}:name", expire=300) diff --git a/src/spaceone/cost_analysis/manager/plugin_manager.py b/src/spaceone/cost_analysis/manager/plugin_manager.py index 65d232e4..6c362ae3 100644 --- a/src/spaceone/cost_analysis/manager/plugin_manager.py +++ b/src/spaceone/cost_analysis/manager/plugin_manager.py @@ -1,9 +1,7 @@ import logging -from spaceone.core import config from spaceone.core.manager import BaseManager from spaceone.core.connector.space_connector import SpaceConnector -from spaceone.core.auth.jwt.jwt_util import JWTUtil _LOGGER = logging.getLogger(__name__) @@ -11,32 +9,22 @@ class PluginManager(BaseManager): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - token = self.transaction.get_meta("token") - self.token_type = JWTUtil.get_value_from_token(token, "typ") self.plugin_connector: SpaceConnector = self.locator.get_connector( - SpaceConnector, service="plugin", token=config.get_global("TOKEN") + SpaceConnector, service="plugin" ) def get_plugin_endpoint(self, plugin_info, domain_id): - if self.token_type == "SYSTEM_TOKEN": - response = self.plugin_connector.dispatch( - "Plugin.get_plugin_endpoint", - { - "plugin_id": plugin_info["plugin_id"], - "version": plugin_info.get("version"), - "upgrade_mode": plugin_info.get("upgrade_mode", "AUTO"), - "domain_id": domain_id, - }, - x_domain_id=domain_id, - ) - else: - response = self.plugin_connector.dispatch( - "Plugin.get_plugin_endpoint", - { - "plugin_id": plugin_info["plugin_id"], - "version": plugin_info.get("version"), - "upgrade_mode": plugin_info.get("upgrade_mode", "AUTO"), - "domain_id": domain_id, - }, - ) + system_token = self.transaction.get_meta("token") + + response = self.plugin_connector.dispatch( + "Plugin.get_plugin_endpoint", + { + "plugin_id": plugin_info["plugin_id"], + "version": plugin_info.get("version"), + "upgrade_mode": plugin_info.get("upgrade_mode", "AUTO"), + "domain_id": domain_id, + }, + token=system_token, + ) + return response["endpoint"], response.get("updated_version") diff --git a/src/spaceone/cost_analysis/manager/secret_manager.py b/src/spaceone/cost_analysis/manager/secret_manager.py index 24979aed..dc5ea569 100644 --- a/src/spaceone/cost_analysis/manager/secret_manager.py +++ b/src/spaceone/cost_analysis/manager/secret_manager.py @@ -63,8 +63,11 @@ def get_secret(self, secret_id: str): return self.secret_connector.dispatch("Secret.get", {"secret_id": secret_id}) def get_secret_data(self, secret_id, domain_id): + system_token = config.get_global("TOKEN") + response = self.secret_connector.dispatch( "Secret.get_data", {"secret_id": secret_id, "domain_id": domain_id}, + token=system_token, ) return response["data"]