Skip to content

Commit a6c36bb

Browse files
committed
Signed-off-by: Marcelo Henrique Neppel <marcelo.neppel@canonical.com>
1 parent 1ff60fa commit a6c36bb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/charm.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,14 @@ def get_hostname_by_unit(self, _) -> str:
439439
return self._unit_ip
440440

441441
def _on_secret_remove(self, event: SecretRemoveEvent) -> None:
442+
# A secret removal (entire removal, not just a revision removal) causes
443+
# https://github.com/juju/juju/issues/20794. This check is to avoid the
444+
# errors that would happen if we tried to remove the revision in that case
445+
# (in the revision removal, the label is present).
446+
if event.secret.label is None:
447+
logger.debug("Secret with no label cannot be removed")
448+
return
449+
logger.debug(f"Removing secret with label {event.secret.label} revision {event.revision}")
442450
event.remove_revision()
443451

444452
def _on_get_primary(self, event: ActionEvent) -> None:

0 commit comments

Comments
 (0)