-
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: add Relation.active, exclude inactive relations from Model.rela…
…tions (#1091) This PR allows Charmers to easily check whether a relation is broken during a `relation-broken` event (and also framework events that share the same Juju context) without having to store state or pass the `event` object around. In addition, the broken relation is excluded from the `Model.relations` list, to make it easy for charms to work on only the relations that will continue to exist after the relation-broken events complete (without having to do `(rel for rel in self.model.relations if rel.active)` themselves. To do this: * In `relation-broken` events, set a new attribute `active` on the event's `Relation` object to False (and have this be True in all other cases). * In `relation-broken` events, `RelationMapping` `__getitem__` excludes the event's relation. Builds on work from @ca-scribner in #958. [Additional background notes] (https://docs.google.com/document/d/1yKLRtfffxxLeH4tkfkOL4ELfzyJK33WC5lQaCZXgjjk/edit?usp=sharing) (limited to Canonical). Fixes #940
- Loading branch information
1 parent
ea1cf19
commit cc29ea3
Showing
8 changed files
with
115 additions
and
10 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
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