]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
changed is_empty_certificate check by a positive certs_present bool 46925/head
authorRedouane Kachach <rkachach@redhat.com>
Tue, 27 Sep 2022 12:10:50 +0000 (14:10 +0200)
committerRedouane Kachach <rkachach@redhat.com>
Tue, 27 Sep 2022 12:10:50 +0000 (14:10 +0200)
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
src/pybind/mgr/cephadm/services/monitoring.py

index be93c32b6694ded482f6d3757eb799719ddcd860..26e6e7fe50bcebe3bf467211f8e1745f6da9f69d 100644 (file)
@@ -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)