Removing pydantic from POL charm
Change-Id: I0c8a7cac50f7f81f61fb151d8166846cf4c4fd18
Signed-off-by: sousaedu <eduardo.sousa@canonical.com>
diff --git a/installers/charm/pol/src/charm.py b/installers/charm/pol/src/charm.py
index 649e15b..6d15c57 100755
--- a/installers/charm/pol/src/charm.py
+++ b/installers/charm/pol/src/charm.py
@@ -21,7 +21,6 @@
##
import logging
-from pydantic import ValidationError
from typing import Any, Dict, NoReturn
from ops.charm import CharmBase, CharmEvents
@@ -99,10 +98,8 @@
Args:
event (EventBase): Kafka relation event.
"""
- data_loc = event.unit if event.unit else event.app
-
- message_host = event.relation.data[data_loc].get("host")
- message_port = event.relation.data[data_loc].get("port")
+ message_host = event.relation.data[event.unit].get("host")
+ message_port = event.relation.data[event.unit].get("port")
if (
message_host
@@ -132,9 +129,7 @@
Args:
event (EventBase): DB relation event.
"""
- data_loc = event.unit if event.unit else event.app
-
- database_uri = event.relation.data[data_loc].get("connection_string")
+ database_uri = event.relation.data[event.unit].get("connection_string")
if database_uri and self.state.database_uri != database_uri:
self.state.database_uri = database_uri
@@ -215,7 +210,7 @@
self.relation_state,
self.model.app.name,
)
- except ValidationError as exc:
+ except ValueError as exc:
logger.exception("Config/Relation data validation error")
self.unit.status = BlockedStatus(str(exc))
return