summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Kavanagh <alex@ajkavanagh.co.uk>2017-02-16 11:37:25 +0000
committerAlex Kavanagh <alex@ajkavanagh.co.uk>2017-02-16 11:37:25 +0000
commitceb612a49d5af8e506d3010c23ed9b87503f89cc (patch)
treeb2b728eb9ce731c15b64fff74d93691917eae833
parent4c8d4683933ed9cea0b65d2226098f4383d20710 (diff)
Work around a strange bug wit reactive/juju 1.25.x
There is a strange bug where, randomly, and only with Juju 1.25.9 or 10, the conversation for a relation doesn't exist, even though the relation has been made. This is a workaround that appears to have no impact on using charm's functionality. The clear_changed() methods are to remove a {relation-name}.changed flag that gets set when the data on the relation changes. However, not being able to clear it, simply means that it will still be set the next time the charm runs which might mean that some handlers run again. This shouldn't be a problem as, by design, reactive handlers MUST be idempotent. Change-Id: I26ec730d88e04fb3942d0240bf4eba6c6642a168 Related-Bug: 1663633
Notes
Notes (review): Verified+1: Canonical CI <uosci-testing-bot@ubuntu.com> Code-Review+2: David Ames <david.ames@canonical.com> Workflow+1: David Ames <david.ames@canonical.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Thu, 16 Feb 2017 15:48:27 +0000 Reviewed-on: https://review.openstack.org/434846 Project: openstack/charm-interface-manila-plugin Branch: refs/heads/master
-rw-r--r--provides.py8
-rw-r--r--requires.py8
2 files changed, 12 insertions, 4 deletions
diff --git a/provides.py b/provides.py
index eca7d67..d2b2cb1 100644
--- a/provides.py
+++ b/provides.py
@@ -93,8 +93,12 @@ class ManilaPluginProvides(reactive.RelationBase):
93 93
94 def clear_changed(self): 94 def clear_changed(self):
95 """Provide a convenient method to clear the .changed relation""" 95 """Provide a convenient method to clear the .changed relation"""
96 conversation = self.conversation() 96 try:
97 conversation.remove_state(self.states.changed) 97 self.remove_state(self.states.changed)
98 except ValueError:
99 # work around Juju 1.25.x error where it can't find the scope for
100 # the interface (randomly) - Bug #1663633
101 pass
98 102
99 @property 103 @property
100 def name(self): 104 def name(self):
diff --git a/requires.py b/requires.py
index c9fbccb..54637bb 100644
--- a/requires.py
+++ b/requires.py
@@ -120,8 +120,12 @@ class ManilaPluginRequires(reactive.RelationBase):
120 120
121 def clear_changed(self): 121 def clear_changed(self):
122 """Provide a convenient method to clear the .changed relation""" 122 """Provide a convenient method to clear the .changed relation"""
123 conversation = self.conversation() 123 try:
124 conversation.remove_state(self.states.changed) 124 self.remove_state(self.states.changed)
125 except ValueError:
126 # this works around a Juju 1.25.x bug where it can't find the right
127 # scoped conversation - Bug #1663633
128 pass
125 129
126 def set_authentication_data(self, value, name=None): 130 def set_authentication_data(self, value, name=None):
127 """Set the authentication data to the plugin charm. This is to enable 131 """Set the authentication data to the plugin charm. This is to enable