Skip to content

BlockedStatus object compared to string list in S3 block message check #1483

@marceloneppel

Description

@marceloneppel

Problem

In src/charm.py on the main branch (line 1755), there is a comparison:

if self.is_blocked and self.unit.status not in S3_BLOCK_MESSAGES:

self.unit.status is a BlockedStatus object, while S3_BLOCK_MESSAGES is a list of strings. A BlockedStatus object will never equal a plain string, so this not in check is always True. The intended S3 block message exclusion never fires.

Affected branches

  • main — bug exists at src/charm.py line 1755
  • 16/edge — needs verification (likely same bug if the line exists)

Impact

The _on_update_status method always early-exits when the charm is in any blocked state, including S3-related blocked states that should allow continued processing (e.g., retrying stanza initialization when S3 settings are fixed).

Fix

Change self.unit.status to self.unit.status.message:

if self.is_blocked and self.unit.status.message not in S3_BLOCK_MESSAGES:

Notes

  • The same bug existed in the K8s charm (canonical/postgresql-k8s-operator) on its main branch and is being fixed by PR Fix substrate #1243 (branch include-pgbackrest-error-details), which switches to is_s3_block_message(self.unit.status.message).
  • Inside backups.py on both charms, the comparison is done correctly using .message (e.g., self.charm.unit.status.message not in S3_BLOCK_MESSAGES). The bug is only in charm.py.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions