Skip to content

Commit

Permalink
Add secret fix for 3.1.7 (#161)
Browse files Browse the repository at this point in the history
This PR extends opensearch_secrets.py to react to new secret-changed
behavior in Juju 3.1.7+, as described in
[LP#2037120](https://bugs.launchpad.net/juju/+bug/2037120).
  • Loading branch information
phvalguima authored Jan 15, 2024
1 parent 98fe0c4 commit 15d0045
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ jobs:
with:
provider: lxd
juju-channel: ${{ inputs.juju-snap-channel }}
bootstrap-options: "--agent-version=3.1.6"

- name: Download packed charm(s)
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -147,7 +146,6 @@ jobs:
with:
provider: lxd
juju-channel: ${{ inputs.juju-snap-channel }}
bootstrap-options: "--agent-version=3.1.6"

- name: Download packed charm(s)
uses: actions/download-artifact@v3
Expand Down
3 changes: 3 additions & 0 deletions lib/charms/opensearch/v0/opensearch_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ def __init__(self, charm, peer_relation: str):

def _on_secret_changed(self, event: SecretChangedEvent):
"""Refresh secret and re-run corresponding actions if needed."""
secret = event.secret
secret.get_content(refresh=True)

if not event.secret.label:
logger.info("Secret %s has no label, ignoring it.", event.secret.id)
return
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/lib/test_opensearch_secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ class TestOpenSearchSecrets(TestOpenSearchInternalData):
def setUp(self):
self.harness = Harness(OpenSearchOperatorCharm)
self.addCleanup(self.harness.cleanup)
# self.charm._on_leader_elected = Mock()
self.harness.set_leader(is_leader=True)
self.harness.begin()

self.charm = self.harness.charm
Expand Down

0 comments on commit 15d0045

Please sign in to comment.