Skip to content

Commit

Permalink
Update TLS certificate interface version to 12
Browse files Browse the repository at this point in the history
Signed-off-by: gatici <gulsum.atici@canonical.com>
  • Loading branch information
gatici committed Sep 11, 2023
1 parent ec67417 commit 30d9e33
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/charms/tls_certificates_interface/v2/tls_certificates.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def _on_all_certificates_invalidated(self, event: AllCertificatesInvalidatedEven

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 11
LIBPATCH = 12

PYDEPS = ["cryptography", "jsonschema"]

Expand Down Expand Up @@ -1170,17 +1170,20 @@ def _revoke_certificates_for_which_no_csr_exists(self, relation_id: int) -> None
self.remove_certificate(certificate=certificate["certificate"])

def get_requirer_csrs_with_no_certs(
self,
self, relation_id: Optional[int] = None
) -> List[Dict[str, Union[int, str, List[Dict[str, str]]]]]:
"""Filters the requirer's units csrs.
Keeps the ones for which no certificate was provided.
Args:
relation_id (int): Relation id
Returns:
list: List of dictionaries that contain the unit's csrs
that don't have a certificate issued.
"""
all_unit_csr_mappings = copy.deepcopy(self.get_requirer_csrs())
all_unit_csr_mappings = copy.deepcopy(self.get_requirer_csrs(relation_id=relation_id))
for unit_csr_mapping in all_unit_csr_mappings:
for csr in unit_csr_mapping["unit_csrs"]: # type: ignore[union-attr]
if self.certificate_issued_for_csr(
Expand Down

0 comments on commit 30d9e33

Please sign in to comment.