Skip to content

Commit

Permalink
Fix warning cert none charm logging (#425)
Browse files Browse the repository at this point in the history
* fixed issue with warning if cert returns None

* removed unused import

---------

Co-authored-by: Luca Bello <[email protected]>
  • Loading branch information
PietroPasotti and lucabello authored Jul 29, 2024
1 parent 4fdbf25 commit 86fc551
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/charms/loki_k8s/v0/charm_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def my_server_cert(self) -> Optional[str]:

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

PYDEPS = ["cosl"]

Expand Down Expand Up @@ -197,11 +197,7 @@ def _get_server_cert(

# we're assuming that the ca cert that signed this unit is the same that has signed loki's
if server_cert is None:
logger.debug(f"{charm.__name__}.{server_cert_getter} returned None.")
logger.warning(
"Charm logs are being sent over insecure http because a ca cert is "
"not provided to the charm_logging module."
)
logger.debug(f"{charm.__name__}.{server_cert_getter} returned None: can't use https.")
return None

if not isinstance(server_cert, str) and not isinstance(server_cert, Path):
Expand Down

0 comments on commit 86fc551

Please sign in to comment.