Skip to content

Commit

Permalink
Merge branch 'main' into feature/tempo_tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
shayancanonical committed Jun 10, 2024
2 parents c5cc7a2 + 137a950 commit dbb00a8
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 38 deletions.
56 changes: 28 additions & 28 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ops = "^2.14.0"
cryptography = "^42.0.8"
jsonschema = "^4.22.0"
tenacity = "^8.3.0"
cosl = "^0.0.11"
cosl = "^0.0.12"
poetry-core = "^1.9.0"
lightkube = "^0.15.2"
lightkube-models = "^1.29.0.6"
Expand All @@ -42,7 +42,7 @@ opentelemetry-exporter-otlp-proto-http = "1.21.0"
optional = true

[tool.poetry.group.format.dependencies]
ruff = "^0.4.7"
ruff = "^0.4.8"

[tool.poetry.group.lint]
optional = true
Expand Down
10 changes: 3 additions & 7 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,11 +606,10 @@ def get_secret(self, scope: Scopes, key: str) -> Optional[str]:
peers = self.model.get_relation(PEER_RELATION_NAME)
if not peers:
return None

secret_key = self._translate_field_to_secret_key(key)
# Old translation in databag is to be taken
if key != secret_key and (
result := self.peer_relation_data(scope).fetch_my_relation_field(peers.id, key)
):
if result := self.peer_relation_data(scope).fetch_my_relation_field(peers.id, key):
return result

return self.peer_relation_data(scope).get_secret(peers.id, secret_key)
Expand All @@ -626,10 +625,7 @@ def set_secret(self, scope: Scopes, key: str, value: Optional[str]) -> Optional[
peers = self.model.get_relation(PEER_RELATION_NAME)
secret_key = self._translate_field_to_secret_key(key)
# Old translation in databag is to be deleted
if key != secret_key and self.peer_relation_data(scope).fetch_my_relation_field(
peers.id, key
):
self.peer_relation_data(scope).delete_relation_data(peers.id, [key])
self.peer_relation_data(scope).delete_relation_data(peers.id, [key])
self.peer_relation_data(scope).set_secret(peers.id, secret_key, value)

def remove_secret(self, scope: Scopes, key: str) -> None:
Expand Down
1 change: 0 additions & 1 deletion src/relations/peers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def __init__(self, charm: CharmBase):
self.framework.observe(charm.on[PEER_RELATION_NAME].relation_joined, self._on_joined)
self.framework.observe(charm.on[PEER_RELATION_NAME].relation_changed, self._on_changed)
self.framework.observe(charm.on.secret_changed, self._on_changed)
self.framework.observe(charm.on.secret_remove, self._on_changed)
self.framework.observe(charm.on[PEER_RELATION_NAME].relation_departed, self._on_departed)
self.framework.observe(charm.on.leader_elected, self._on_leader_elected)

Expand Down

0 comments on commit dbb00a8

Please sign in to comment.