diff --git a/dns-policy-operator/lib/charms/data_platform_libs/v0/data_interfaces.py b/dns-policy-operator/lib/charms/data_platform_libs/v0/data_interfaces.py index aa798149..5be1d931 100644 --- a/dns-policy-operator/lib/charms/data_platform_libs/v0/data_interfaces.py +++ b/dns-policy-operator/lib/charms/data_platform_libs/v0/data_interfaces.py @@ -453,7 +453,7 @@ def _on_subject_requested(self, event: SubjectRequestedEvent): # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 56 +LIBPATCH = 58 PYDEPS = ["ops>=2.0.0"] @@ -842,6 +842,11 @@ def _legacy_compat_find_secret_by_old_label(self) -> None: self._secret_meta = self._model.get_secret(label=label) except SecretNotFoundError: pass + except ModelError as e: + # Permission denied can be raised if the secret exists but is not yet granted to us. + if "permission denied" in str(e): + return + raise else: if label != self.label: self.current_label = label @@ -876,6 +881,8 @@ def _legacy_migration_to_new_label_if_needed(self) -> None: except ModelError as err: if MODEL_ERRORS["not_leader"] not in str(err): raise + if "permission denied" not in str(err): + raise self.current_label = None ########################################################################## @@ -4268,6 +4275,14 @@ def _on_secret_changed_event(self, event: SecretChangedEvent): if relation.app == self.charm.app: logging.info("Secret changed event ignored for Secret Owner") + if relation.name != self.relation_data.relation_name: + logger.debug( + "Ignoring secret-changed from endpoint %s (expected %s)", + relation.name, + self.relation_data.relation_name, + ) + return + remote_unit = None for unit in relation.units: if unit.app != self.charm.app: @@ -5294,6 +5309,14 @@ def _on_secret_changed_event(self, event: SecretChangedEvent): ) return + if relation.name != self.relation_data.relation_name: + logger.debug( + "Ignoring secret-changed from endpoint %s (expected %s)", + relation.name, + self.relation_data.relation_name, + ) + return + if relation.app == self.charm.app: logging.info("Secret changed event ignored for Secret Owner") @@ -5556,6 +5579,14 @@ def _on_secret_changed_event(self, event: SecretChangedEvent): ) return + if relation.name != self.relation_data.relation_name: + logger.debug( + "Ignoring secret-changed from endpoint %s (expected %s)", + relation.name, + self.relation_data.relation_name, + ) + return + if relation.app == self.charm.app: logging.info("Secret changed event ignored for Secret Owner") @@ -5701,6 +5732,14 @@ def _on_secret_changed_event(self, event: SecretChangedEvent): if relation.app == self.charm.app: logging.info("Secret changed event ignored for Secret Owner") + if relation.name != self.relation_data.relation_name: + logger.debug( + "Ignoring secret-changed from endpoint %s (expected %s)", + relation.name, + self.relation_data.relation_name, + ) + return + remote_unit = None for unit in relation.units: if unit.app != self.charm.app: diff --git a/dns-policy-operator/lib/charms/operator_libs_linux/v1/systemd.py b/dns-policy-operator/lib/charms/operator_libs_linux/v1/systemd.py index cdcbad6a..ea9e6f58 100644 --- a/dns-policy-operator/lib/charms/operator_libs_linux/v1/systemd.py +++ b/dns-policy-operator/lib/charms/operator_libs_linux/v1/systemd.py @@ -13,7 +13,20 @@ # limitations under the License. -"""Abstractions for stopping, starting and managing system services via systemd. +"""Legacy Charmhub-hosted systemd library, deprecated in favour of ``charmlibs.systemd``. + +WARNING: This library is deprecated and will no longer receive feature updates or bugfixes. +``charmlibs.systemd`` version 1.0 is a bug-for-bug compatible migration of this library. +Add 'charmlibs-systemd~=1.0' to your charm's dependencies, and remove this Charmhub-hosted library. +Then replace `from charms.operator_libs_linux.v0 import systemd` with +`from charmlibs import systemd`. +Read more: +- https://documentation.ubuntu.com/charmlibs +- https://pypi.org/project/charmlibs-systemd + +--- + +Abstractions for stopping, starting and managing system services via systemd. This library assumes that your charm is running on a platform that uses systemd. E.g., Centos 7 or later, Ubuntu Xenial (16.04) or later. @@ -64,7 +77,7 @@ # Increment this PATCH version before using `charmcraft publish-lib` or reset # to 0 if you are raising the major API version -LIBPATCH = 4 +LIBPATCH = 5 class SystemdError(Exception):