Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
[WIP] Bug fix: only remove states when last remote unit departs. #2
Conversation
| @@ -37,12 +37,12 @@ def joined_or_changed(self): | ||
| @hook('{provides:kube-control}-relation-{broken,departed}') |
johnsca
Apr 24, 2017
Owner
The -broken hook completely fails with the current conversation model for interface layers because there is no REMOTE_UNIT and that's not handled well. It also doesn't have a real use in the reactive pattern because you should be removing the states on a per-unit basis anyway and -broken just becomes the state being removed from the last conversation and thus starting to match @when_not again.
TL;DR: interface layers should only ever use -departed and using -broken can cause some strange issues.
| - conv = self.conversation() | ||
| - conv.remove_state('{relation_name}.connected') | ||
| - conv.remove_state('{relation_name}.gpu.available') | ||
| + if not self.conversations(): |
johnsca
Apr 24, 2017
•
Owner
In an @hook context, there will always be exactly one conversation, for the REMOTE_UNIT of the hook. I think that this interface layer is actually correct (save for the -broken hook issue mentioned in the other comment) and the issue may be in how it's being used in the charm layer.
tvansteenburgh commentedApr 21, 2017
•
Edited 1 time
-
tvansteenburgh
Apr 21, 2017
Fixes #1.
Not tested yet.