Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Workaround getcert issue when cert key-file is missing #243

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions module_utils/certificate_lsr/providers/certmonger.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
HAS_DBUS = True
DBUS_IMPORT_ERROR = None

import os

from ansible.module_utils.certificate_lsr.providers import base


Expand Down Expand Up @@ -254,6 +256,18 @@ def request_certificate(self):
command = [getcert_bin]

if self.exists_in_certmonger:
# if certificate exists in certmonger and key-file is missing,
# reissuing the certificate will hang certmonger.
# See: https://issues.redhat.com/browse/RHEL-69043
keyfile = self._certmonger_metadata.get("key-file")
if keyfile and not os.path.isfile(keyfile):
self.module.fail_json(
"Resubmiting a request without the private key "
"file may hang certmonger. Please, stop monitoring "
"certificate '{0}' before reissuing.".format(
self._certmonger_metadata.get("nickname")
)
)
command += ["resubmit"]
else:
command += ["request"]
Expand Down
Loading