From: Redouane Kachach Date: Tue, 27 Sep 2022 12:10:50 +0000 (+0200) Subject: changed is_empty_certificate check by a positive certs_present bool X-Git-Tag: v18.1.0~1067^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=86ba7c5eeb9659cc2ce16b5f25ce197eadc65c85;p=ceph.git changed is_empty_certificate check by a positive certs_present bool Signed-off-by: Redouane Kachach --- diff --git a/src/pybind/mgr/cephadm/services/monitoring.py b/src/pybind/mgr/cephadm/services/monitoring.py index be93c32b6694d..26e6e7fe50bce 100644 --- a/src/pybind/mgr/cephadm/services/monitoring.py +++ b/src/pybind/mgr/cephadm/services/monitoring.py @@ -80,10 +80,10 @@ class GrafanaService(CephadmService): key_path = f'{daemon_spec.host}/grafana_key' cert = self.mgr.get_store(cert_path) pkey = self.mgr.get_store(key_path) - is_empty_certificate = not (cert and pkey) + certs_present = (cert and pkey) is_valid_certificate = False (org, cn) = (None, None) - if not is_empty_certificate: + if certs_present: try: (org, cn) = get_cert_issuer_info(cert) verify_tls(cert, pkey) @@ -99,7 +99,7 @@ class GrafanaService(CephadmService): # certificate is not valid, to avoid overwriting user generated # certificates we only re-generate in case of self signed certificates # that were originally generated by cephadm or in case cert/key are empty. - if is_empty_certificate or (org == 'Ceph' and cn == 'cephadm'): + if not certs_present or (org == 'Ceph' and cn == 'cephadm'): logger.info('Regenerating cephadm self-signed grafana TLS certificates') cert, pkey = create_self_signed_cert('Ceph', daemon_spec.host) self.mgr.set_store(cert_path, cert)