Skip to content
This repository has been archived by the owner on Mar 4, 2024. It is now read-only.

Fix edge case where interface can get stuck unjoined #5

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions provides.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/python

from charms.reactive import Endpoint
from charms.reactive import when, when_not
from charms.reactive import when_any, when_not
from charms.reactive import set_state, remove_state


class CNIPluginProvider(Endpoint):

@when('endpoint.{endpoint_name}.changed')
@when_any('endpoint.{endpoint_name}.joined',
'endpoint.{endpoint_name}.changed')
def changed(self):
''' Set the connected state from the provides side of the relation. '''
set_state(self.expand_name('{endpoint_name}.connected'))
Expand Down
5 changes: 3 additions & 2 deletions requires.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
#!/usr/bin/python

from charms.reactive import Endpoint
from charms.reactive import when, when_not
from charms.reactive import when_any, when_not
from charms.reactive import set_state, remove_state


class CNIPluginClient(Endpoint):

@when('endpoint.{endpoint_name}.changed')
@when_any('endpoint.{endpoint_name}.joined',
'endpoint.{endpoint_name}.changed')
def changed(self):
''' Indicate the relation is connected, and if the relation data is
set it is also available. '''
Expand Down