Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix redis self.app.name error in pgbouncer-k8s CI #81

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/charms/redis_k8s/v0/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@

logger = logging.getLogger(__name__)

DEFAULT_REALTION_NAME = "redis"
DEFAULT_RELATION_NAME = "redis"


class RedisRelationUpdatedEvent(EventBase):
"""An event for the redis relation having been updated."""
Expand All @@ -56,7 +57,7 @@ class RedisRelationCharmEvents(CharmEvents):

class RedisRequires(Object):

def __init__(self, charm, relation_name: str = DEFAULT_REALTION_NAME):
def __init__(self, charm, relation_name: str = DEFAULT_RELATION_NAME):
"""A class implementing the redis requires relation."""
super().__init__(charm, relation_name)
self.framework.observe(charm.on[relation_name].relation_joined, self._on_relation_changed)
Expand Down Expand Up @@ -109,7 +110,7 @@ def url(self) -> Optional[str]:
class RedisProvides(Object):
def __init__(self, charm, port):
"""A class implementing the redis provides relation."""
super().__init__(charm, DEFAULT_REALTION_NAME)
super().__init__(charm, DEFAULT_RELATION_NAME)
self.framework.observe(charm.on.redis_relation_changed, self._on_relation_changed)
self._port = port
self._charm = charm
Expand All @@ -128,7 +129,7 @@ def _bind_address(self, event):
relation = self.model.get_relation(event.relation.name, event.relation.id)
if address := self.model.get_binding(relation).network.bind_address:
return address
return self.app.name
return self._charm.app.name

def _get_master_ip(self) -> str:
"""Gets the ip of the current redis master."""
Expand Down
Loading