From 5af86115012bc51090b78a24bd9c51c2fc4e3054 Mon Sep 17 00:00:00 2001 From: Ricardo Dias Date: Mon, 11 Mar 2019 15:43:13 +0000 Subject: [PATCH] mgr/dashboard: iscsi: use `ssl_verify` configuration option in restclient Signed-off-by: Ricardo Dias --- src/pybind/mgr/dashboard/services/iscsi_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/iscsi_client.py b/src/pybind/mgr/dashboard/services/iscsi_client.py index cbbc14af3bd6d..94dad37296cff 100644 --- a/src/pybind/mgr/dashboard/services/iscsi_client.py +++ b/src/pybind/mgr/dashboard/services/iscsi_client.py @@ -13,6 +13,7 @@ except ImportError: from .iscsi_cli import IscsiGatewaysConfig from .. import logger +from ..settings import Settings from ..rest_client import RestClient @@ -30,7 +31,8 @@ class IscsiClient(RestClient): service_url = gateways_config['service_url'] instance = cls._instances.get(gateway_name) - if not instance or service_url != instance.service_url: + if not instance or service_url != instance.service_url or \ + instance.session.verify != Settings.ISCSI_API_SSL_VERIFICATION: url = urlparse(service_url) ssl = url.scheme == 'https' host = url.hostname @@ -39,8 +41,10 @@ class IscsiClient(RestClient): password = url.password if not port: port = 443 if ssl else 80 + auth = HTTPBasicAuth(username, password) - instance = IscsiClient(host, port, IscsiClient._CLIENT_NAME, ssl, auth) + instance = IscsiClient(host, port, IscsiClient._CLIENT_NAME, ssl, + auth, Settings.ISCSI_API_SSL_VERIFICATION) instance.service_url = service_url cls._instances[gateway_name] = instance -- 2.39.5