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

Main to rebac #1022

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions .github/workflows/charm-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build local images
run: make jimm-image
- name: Upload charm to charmhub
Expand All @@ -51,6 +53,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@master
with:
name: jimm-snap
Expand Down
8 changes: 8 additions & 0 deletions charms/jimm-k8s/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,14 @@ def _on_dashboard_relation_joined(self, event: RelationJoinedEvent):
def _on_database_event(self, event: DatabaseEvent) -> None:
"""Database event handler."""

if event.username is None or event.password is None:
event.defer()
logger.info(
"(postgresql) Relation data is not complete (missing `username` or `password` field); "
"deferring the event."
)
return

# get the first endpoint from a comma separate list
ep = event.endpoints.split(",", 1)[0]
# compose the db connection string
Expand Down
8 changes: 8 additions & 0 deletions charms/jimm/src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ def _on_database_event(self, event: DatabaseRequiresEvent):
event.defer()
return

if event.username is None or event.password is None:
event.defer()
logger.info(
"(postgresql) Relation data is not complete (missing `username` or `password` field); "
"deferring the event."
)
return

# get the first endpoint from a comma separate list
host = event.endpoints.split(",", 1)[0]
# compose the db connection string
Expand Down