From 959f1762b95ffc4b6d91832df79d9d0d3dd58839 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Wed, 20 Aug 2025 14:42:42 +0200 Subject: [PATCH] JSON-RPC: disable server-side logging with rpc_transport=none Otherwise, the same message appears twice: on the server and on the client sides. Change-Id: I69f2bc9024f2b399ae73d665b971202398f4d2e4 Signed-off-by: Dmitry Tantsur --- ironic/common/json_rpc/server.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ironic/common/json_rpc/server.py b/ironic/common/json_rpc/server.py index cf3cd2c2a2..ba9b99a433 100644 --- a/ironic/common/json_rpc/server.py +++ b/ironic/common/json_rpc/server.py @@ -120,6 +120,7 @@ class WSGIService(wsgi_service.BaseWSGIService): else: app = self._application super().__init__('ironic-json-rpc', app, CONF.json_rpc) + self._debug = CONF.rpc_transport != 'none' def _application(self, environment, start_response): """WSGI application for conductor JSON RPC.""" @@ -262,7 +263,9 @@ class WSGIService(wsgi_service.BaseWSGIService): for key, value in params.items()} params['context'] = context - LOG.debug('RPC %s with %s', name, logged_params) + if self._debug: + LOG.debug('RPC %s with %s', name, logged_params) + try: result = func(**params) # FIXME(dtantsur): we could use the inspect module, but @@ -275,7 +278,9 @@ class WSGIService(wsgi_service.BaseWSGIService): # Currently it seems that we can serialize even with invalid # context, but I'm not sure it's guaranteed to be the case. result = self.serializer.serialize_entity(context, result) - LOG.debug('RPC %s returned %s', name, - strutils.mask_dict_password(result) - if isinstance(result, dict) else result) + + if self._debug: + LOG.debug('RPC %s returned %s', name, + strutils.mask_dict_password(result) + if isinstance(result, dict) else result) return result