Skip to content

Commit

Permalink
Merge pull request #1022 from kian99/main-to-rebac
Browse files Browse the repository at this point in the history
Main to rebac
  • Loading branch information
kian99 committed Aug 3, 2023
2 parents 6fee82c + db79fec commit 530b76d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
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

0 comments on commit 530b76d

Please sign in to comment.