-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for Pebble Notices (#1086)
This PR implements Ops support for Pebble Notices (described in[JU048] (https://docs.google.com/document/d/16PJ85fefalQd7JbWSxkRWn0Ye-Hs8S1yE99eW7pk8fA/edit), with the user ID details in [OP042] (https://docs.google.com/document/d/1tQwUxz-rV-NjH-UodDbSDhGcMJGfD3OSoTnBLI9aoGU/edit)). This adds a new `PebbleNoticeEvent` base event type, with `PebbleCustomNoticeEvent` being the first concrete type -- we'll have more later, such as for `warning` and `change-update` notices. These events have a `notice` attribute which is a `LazyNotice` instance: if you only access `id` or `type` or `key` it won't require a call to Pebble (I think only accessing `key` will be common in charms). In addition, this adds `get_notice` and `get_notices` methods to both `pebble.Client` and `model.Container`. These return objects of the new `Notice` type. The `timeconv.parse_duration` helper function is needed by `Notice.from_dict`, to parse Go's [`time.Duration.String`] (https://pkg.go.dev/time#Duration.String) format that Pebble uses for the `repeat-after` and `expire-after` fields. Most of the test cases for this were taken from [Go's test cases] (https://cs.opensource.google/go/go/+/refs/tags/go1.21.5:src/time/time_test.go;l=891). This PR does *not* include `Harness` support for Pebble Notices. I plan to add that in a follow-up PR soon (using a `Harness.pebble_notify` function and implementing the `get_notice` and `get_notices` test backend functions).
- Loading branch information
Showing
15 changed files
with
809 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.