Skip to content

2.10.0 Pebble custom notices, adjustments to relation-broken, and more

Compare
Choose a tag to compare
@tonyandrewmeyer tonyandrewmeyer released this 31 Jan 02:00
· 50 commits to main since this release
3dd4621

This release adds support for Pebble custom notices, including in the Harness testing framework, and removes the broken relation from the model's relations list when in the relation-broken event. There's also the usual collection of documentation improvements, bug fixes, and other minor improvements.

Pebble Notices

Pebble now includes a subsystem called Notices, each of which has a type and a key (currently the only type is "custom"). Custom notices allow the workload to wake up the charm when something interesting happens with the workload, for example, when a PostgreSQL backup process finishes, or some kind of alert occurs.

Workloads can run pebble notify to record an occurrence of a custom notice, providing a unique key and optional data, and Juju will trigger a PebbleCustomNotice event on the charm for it to take appropriate action.

Support for Pebble Notices is available from Juju 3.4.0 onwards. Read the docs about how to use custom notices from the workload container.

Relation-Broken

When a charm is handling a relation-broken event, the relation is on the verge of being removed. A common pattern in charms is to iterate through Model.relations (to generate a configuration file, for example), and the broken relation should not be included with the active relations. To simplify charm code, Model.relations now excludes the broken relation. The relation is still accessible via the event's .relation attribute, and all Relation objects now have an .active attribute to distinguish between the broken relation (active == False) and other relations (active == True).

The plan is that this change will also appear when using the Juju hook tools directly in a future version of Juju.

This does not change accessing the relation data during relation-broken, and this does not change any behaviour in relation-departed.

Features

  • feat: support for Pebble Notices in #1086 and in #1100
  • feat: add Relation.active, exclude inactive relations from Model.relations in #1091
  • feat: when handling actions, print uncaught exceptions to stderr in #1087
  • feat: model error on testing module if invalid status set by charm by @yanksyoon in #1107
  • feat: add support for v2 fields in CharmMeta in #1106

Fixes

Documentation

  • docs: update README.md in light of changes to charmcraft init output by @tmihoc in #1089
  • docs: document limitations with pushing locked or bind-mount files in #1094
  • docs: add instructions on how to use a custom version of ops in a Charm in #1092

Tooling

  • build: migrate to pyproject.toml in #1068
  • ci: use a trusted publisher token for publishing to PyPI in #1061
  • fix(typing): update to latest version of Pyright and fix errors in #1105

Many thanks to @PietroPasotti, @yanksyoon, and @tmihoc for their contributions to this release!

Full Changelog: 2.9.0...2.10.0