From: Mykola Golub Date: Thu, 16 Feb 2023 09:33:45 +0000 (+0200) Subject: mgr/cephadm: don't add mgr into iscsi trusted_ip_list if it's already there X-Git-Tag: v18.1.0~137^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4a9b6a9f33999244f8e83d5d2bcc0e0818d7260e;p=ceph.git mgr/cephadm: don't add mgr into iscsi trusted_ip_list if it's already there Fixes: https://tracker.ceph.com/issues/58792 Signed-off-by: Mykola Golub (cherry picked from commit 4a74a020a7754f0dac533a50e085f5690df90798) --- diff --git a/src/pybind/mgr/cephadm/services/iscsi.py b/src/pybind/mgr/cephadm/services/iscsi.py index c42eff6838d9..61b157b444ca 100644 --- a/src/pybind/mgr/cephadm/services/iscsi.py +++ b/src/pybind/mgr/cephadm/services/iscsi.py @@ -26,9 +26,11 @@ class IscsiService(CephService): def get_trusted_ips(self, spec: IscsiServiceSpec) -> str: # add active mgr ip address to trusted list so dashboard can access trusted_ip_list = spec.trusted_ip_list if spec.trusted_ip_list else '' - if trusted_ip_list: - trusted_ip_list += ',' - trusted_ip_list += self.mgr.get_mgr_ip() + mgr_ip = self.mgr.get_mgr_ip() + if mgr_ip not in [s.strip() for s in trusted_ip_list.split(',')]: + if trusted_ip_list: + trusted_ip_list += ',' + trusted_ip_list += mgr_ip return trusted_ip_list def prepare_create(self, daemon_spec: CephadmDaemonDeploySpec) -> CephadmDaemonDeploySpec: