Add necessary translators to peer handler context

BasePeer handler currently changes any '-' characters
in app databag keys to '_'. Handle '/' and '.' as well.
Charm microceph uses app databag keys like
'microceph/0,join_token'

Change-Id: I6091ba503e8711fcc6a43f672cfecc01eff44561
This commit is contained in:
Hemanth Nakkina 2024-07-03 15:06:25 +05:30 committed by Hemanth N
parent 5f0a53a5d3
commit 366b83e3eb

View File

@ -584,8 +584,9 @@ class BasePeerHandler(RelationHandler):
def context(self) -> dict:
"""Return all app data set on the peer relation."""
try:
translators = str.maketrans({"/": "_", ".": "_", "-": "_"})
_db = {
k.replace("-", "_"): v
k.translate(translators): v
for k, v in self.interface.get_all_app_data().items()
}
return _db