From e5003a6af510de047f8716e423669db76a463604 Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Thu, 6 Mar 2025 15:04:54 +0100 Subject: [PATCH] mgr/cepahdm: adding a message when certificates check is OK Signed-off-by: Redouane Kachach --- src/pybind/mgr/cephadm/module.py | 9 ++++++--- src/pybind/mgr/orchestrator/module.py | 9 +++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index d3b027ce1fd50..2bbc58932fc2d 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -3216,9 +3216,12 @@ Then run the following: def cert_store_cert_check(self) -> List[str]: report = [] _, certs_with_issues = self.cert_mgr.check_services_certificates(fix_issues=False) - for cert_info in certs_with_issues: - if not cert_info.is_operationally_valid(): - report.append(cert_info.get_status_description()) + if certs_with_issues: + for cert_info in certs_with_issues: + if not cert_info.is_operationally_valid(): + report.append(cert_info.get_status_description()) + else: + report.append('All certificates are valid. No issues detected.') return report @handle_orch_error diff --git a/src/pybind/mgr/orchestrator/module.py b/src/pybind/mgr/orchestrator/module.py index d362bbcabb585..d099a4641021a 100644 --- a/src/pybind/mgr/orchestrator/module.py +++ b/src/pybind/mgr/orchestrator/module.py @@ -1251,6 +1251,9 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, force: Optional[bool] = False, inbuf: Optional[str] = None ) -> HandleCommandResult: + """ + Sets the cert-key pair from -i , which must be a valid PEM file containing both the certificate and the private key. + """ if inbuf: cert_content, key_content = parse_combined_pem_file(inbuf) if not cert_content or not key_content: @@ -1282,6 +1285,9 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, hostname: Optional[str] = None, inbuf: Optional[str] = None ) -> HandleCommandResult: + """ + Sets the cert from the --cert argument or from -i . + """ cert_content = cert or inbuf if not cert_content: raise OrchestratorError('This command requires passing a certificate using --cert parameter or "-i " option') @@ -1305,6 +1311,9 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule, hostname: Optional[str] = None, inbuf: Optional[str] = None ) -> HandleCommandResult: + """ + Sets the key from the --key argument or from -i . + """ key_content = key or inbuf if not key_content: raise OrchestratorError('This command requires passing a key using --key parameter or "-i " option') -- 2.39.5