Skip to content

Commit

Permalink
fix race condition in privkey generation (#76)
Browse files Browse the repository at this point in the history
* fix race condition in privkey generation

* fix static checks in other libs

* tox fmt
  • Loading branch information
lucabello authored and Abuelodelanada committed Feb 20, 2024
1 parent 733c533 commit 4173320
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def setUp(self, *unused):

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


_Decimal = Union[Decimal, float, str, int] # types that are potentially convertible to Decimal
Expand Down Expand Up @@ -364,7 +364,7 @@ def is_patched(self, resource_reqs: ResourceRequirements) -> bool:
Returns:
bool: A boolean indicating if the service patch has been applied.
"""
return equals_canonically(self.get_templated(), resource_reqs)
return equals_canonically(self.get_templated(), resource_reqs) # pyright: ignore

def get_templated(self) -> Optional[ResourceRequirements]:
"""Returns the resource limits specified in the StatefulSet template."""
Expand Down Expand Up @@ -397,8 +397,8 @@ def is_ready(self, pod_name, resource_reqs: ResourceRequirements):
self.get_templated(),
self.get_actual(pod_name),
)
return self.is_patched(resource_reqs) and equals_canonically(
resource_reqs, self.get_actual(pod_name)
return self.is_patched(resource_reqs) and equals_canonically( # pyright: ignore
resource_reqs, self.get_actual(pod_name) # pyright: ignore
)

def apply(self, resource_reqs: ResourceRequirements) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _on_endpoints_change(self, event):

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

# File path where metrics endpoint change data is written for exchange
# between the discovery process and the materialised event.
Expand Down Expand Up @@ -215,7 +215,7 @@ def main():

target_ports = []
for c in filter(lambda c: c.ports is not None, entity.spec.containers): # pyright: ignore
for p in filter(lambda p: p.name == "metrics", c.ports):
for p in filter(lambda p: p.name == "metrics", c.ports): # pyright: ignore
target_ports.append("*:{}".format(p.containerPort))

payload = {
Expand Down
1 change: 1 addition & 0 deletions lib/charms/observability_libs/v1/cert_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ def _on_config_changed(self, _):
if not relation:
return

self._generate_privkey()
self._generate_csr(renew=True)

def _generate_csr(
Expand Down

0 comments on commit 4173320

Please sign in to comment.