Skip to content

Commit b047b5c

Browse files
authored
Strip the CSR from event for correct comparison (#52)
* Strip csr from event for correct comparison * Lint * Bump LIBPATCH
1 parent 63672f9 commit b047b5c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/charms/observability_libs/v0/cert_handler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262

6363
LIBID = "b5cd5cd580f3428fa5f59a8876dcbe6a"
6464
LIBAPI = 0
65-
LIBPATCH = 2
65+
LIBPATCH = 3
6666

6767

6868
class CertChanged(EventBase):
@@ -257,7 +257,12 @@ def _on_certificate_available(self, event: CertificateAvailableEvent) -> None:
257257
# relation-changed. If that is not the case, we would need more guards and more paths.
258258

259259
# Process the cert only if it belongs to the unit that requested it (this unit)
260-
if event.certificate_signing_request == self._csr:
260+
event_csr = (
261+
event.certificate_signing_request.strip()
262+
if event.certificate_signing_request
263+
else None
264+
)
265+
if event_csr == self._csr:
261266
self._ca_cert = event.ca
262267
self._server_cert = event.certificate
263268
self._chain = event.chain

0 commit comments

Comments
 (0)