operator icon indicating copy to clipboard operation
operator copied to clipboard

K8s tutorial: Clarify how status is set if no relation data

Open dwilding opened this issue 5 months ago • 0 comments

In Integrate your charm with PostgreSQL, the definition of fetch_postgres_relation_data has a comment that says:

[...] If no data is retrieved, the unit is set to waiting status and the program exits with a zero status code.

This is confusing for several reasons:

  • The method itself doesn't set the unit status. Instead, later in the doc we're adding a collect-status handler that sets waiting status.
  • Even in the collect-status handler, fetch_postgres_relation_data isn't called. Instead, both places use self.database.fetch_relation_data.
  • "The program exists with a zero status" is technically true but not very helpful. We don't usually think of charms as programs that exit with particular status codes.

Discussion in Matrix: https://matrix.to/#/!LhFxJIPEcCacgdMghH:ubuntu.com/$yreC1AD_wDNvYYL18CyzXL6UPOp1yeCbVV28BpiIswc

dwilding avatar Oct 08 '25 23:10 dwilding