From: Nizamudeen A Date: Tue, 16 Jul 2024 14:33:24 +0000 (+0530) Subject: mgr/dashboard: nvmf apis broken for insecure channel X-Git-Tag: v20.0.0~1495^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=36a4a72959c1428d7295f3e24e5f94c937cff6a6;p=ceph.git mgr/dashboard: nvmf apis broken for insecure channel because when no certificate, it raises an exception which stops the api call abruptly. Signed-off-by: Nizamudeen A --- diff --git a/src/pybind/mgr/dashboard/services/nvmeof_conf.py b/src/pybind/mgr/dashboard/services/nvmeof_conf.py index 3879e308db471..4d3f312eb485b 100644 --- a/src/pybind/mgr/dashboard/services/nvmeof_conf.py +++ b/src/pybind/mgr/dashboard/services/nvmeof_conf.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- import json +import logging from orchestrator import OrchestratorError @@ -8,6 +9,7 @@ from .. import mgr from ..exceptions import DashboardException from ..services.orchestrator import OrchClient +logger = logging.getLogger('nvmeof_conf') class NvmeofGatewayAlreadyExists(Exception): def __init__(self, gateway_name): @@ -87,12 +89,9 @@ class NvmeofGatewaysConfig(object): @classmethod def get_root_ca_cert(cls, service_name: str): - try: - root_ca_cert = cls.from_cert_store('nvmeof_root_ca_cert', service_name) - return root_ca_cert.encode() - except DashboardException: - # If root_ca_cert is not set, use server_cert as root_ca_cert - return cls.get_server_cert(service_name) + root_ca_cert = cls.from_cert_store('nvmeof_root_ca_cert', service_name) + # If root_ca_cert is not set, use server_cert as root_ca_cert + return root_ca_cert.encode() if root_ca_cert else cls.get_server_cert(service_name) @classmethod def get_server_cert(cls, service_name: str): @@ -108,7 +107,7 @@ class NvmeofGatewaysConfig(object): return orch.cert_store.get_key(entity, service_name) return orch.cert_store.get_cert(entity, service_name) return None - except OrchestratorError as e: - raise DashboardException( - msg=f'Failed to get {entity} for {service_name}: {e}', - ) + except OrchestratorError: + # just return None if any orchestrator error is raised + # otherwise nvmeof api will raise this error and doesn't proceed. + return None