Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support change-update notice and pebble-change-updated event #1170

Merged
merged 5 commits into from Apr 9, 2024

Conversation

benhoyt
Copy link
Collaborator

@benhoyt benhoyt commented Mar 28, 2024

This adds support for the new pebble-change-updated event (Juju PR juju/juju#17118), adding a new PebbleChangeUpdatedEvent type and {container_name}_pebble_change_updated event you can observe.

The event has a get_change() method to easily fetch the associated pebble.Change object.

It also adds Harness.pebble_notify support for the pebble.NoticeType.CHANGE_UPDATE notice type. To use that, you say:

notice_id = harness.pebble_notify('<container>', '<change-id>', type=pebble.NoticeType.CHANGE_UPDATE)

ops/charm.py Show resolved Hide resolved
@benhoyt benhoyt marked this pull request as ready for review April 4, 2024 02:32
ops/pebble.py Outdated Show resolved Hide resolved
ops/pebble.py Outdated Show resolved Hide resolved
ops/charm.py Show resolved Hide resolved
Copy link
Contributor

@tonyandrewmeyer tonyandrewmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, thanks!

CUSTOM = 'custom'
"""A custom notice reported via the Pebble client API or ``pebble notify``.
The key and data fields are provided by the user. The key must be in
the format ``example.com/path`` to ensure well-namespaced notice keys.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we validate this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we validate it (in the Pebble server), so the workload will get an error if it tries to add a custom notice (pebble notify) with an invalid key. The API does "reasonable effort" validation with a regex.

@benhoyt benhoyt merged commit b7e5ba3 into canonical:main Apr 9, 2024
28 checks passed
@benhoyt benhoyt deleted the change-update-notice branch April 9, 2024 05:37
benhoyt added a commit to benhoyt/operator that referenced this pull request Apr 12, 2024
benhoyt added a commit that referenced this pull request Apr 12, 2024
)

This reverts #1170 (commit b7e5ba3) as
this feature has been reverted in Juju on the 3.5 branch, due to the
issues described at this PR: juju/juju#17191
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants