Skip to content

Commit

Permalink
etc: add LOGGER for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jiyungSong committed Jun 2, 2023
1 parent 2c3f492 commit 4cd8400
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/spaceone/plugin/api/v1/plugin.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: utf-8 -*-

import logging
from spaceone.api.plugin.v1 import plugin_pb2, plugin_pb2_grpc
from spaceone.core.pygrpc import BaseAPI

_LOGGER = logging.getLogger(__name__)


class Plugin(BaseAPI, plugin_pb2_grpc.PluginServicer):

Expand Down Expand Up @@ -37,6 +38,7 @@ def get_plugin_metadata(self, request, context):

with self.locator.get_service('PluginService', metadata) as plugin_svc:
metadata = plugin_svc.get_plugin_metadata(params)
_LOGGER.debug(f'[get_plugin_metadata] {metadata}')
return self.locator.get_info('PluginMetadata', metadata)

def notify_failure(self, request, context):
Expand Down
10 changes: 8 additions & 2 deletions src/spaceone/plugin/info/plugin_info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
import functools

from spaceone.api.plugin.v1 import plugin_pb2
Expand All @@ -7,6 +8,8 @@

__all__ = ['PluginInfo', 'PluginsInfo', 'PluginEndpoint', 'PluginMetadata']

_LOGGER = logging.getLogger(__name__)


def PluginInfo(plugin_vo: InstalledPluginRef, minimal=False):
if isinstance(plugin_vo, InstalledPluginRef):
Expand All @@ -33,7 +36,6 @@ def PluginInfo(plugin_vo: InstalledPluginRef, minimal=False):
'supervisor_id': plugin_vo.supervisor_id,
'managed': True,
'domain_id': plugin_vo.domain_id

}
return supervisor_pb2.PluginInfo(**info)

Expand All @@ -49,4 +51,8 @@ def PluginEndpoint(endpoint):


def PluginMetadata(metadata):
return plugin_pb2.PluginMetadata(**metadata)
info = {
'metadata': change_struct_type(metadata)
}
_LOGGER.debug(f'[PluginMetadata] {info}')
return plugin_pb2.PluginMetadata(**info)
1 change: 1 addition & 0 deletions src/spaceone/plugin/service/plugin_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def get_plugin_metadata(self, params: dict):
plugin_endpoint_info = self._get_plugin_endpoint(params)
api_class = self._get_plugin_api_class(plugin_id, domain_id)
init_response = self.plugin_mgr.init_plugin(plugin_endpoint_info.get('endpoint'), api_class, {}, domain_id)
_LOGGER.debug(f'[get_plugin_metadata] init_response: {init_response}')
return {'metadata': init_response.get('metadata', {})}

def _get_plugin_endpoint(self, params):
Expand Down

0 comments on commit 4cd8400

Please sign in to comment.