diff --git a/requires.py b/requires.py index 5626d1b..93c7a53 100644 --- a/requires.py +++ b/requires.py @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from charmhelpers.core import hookenv from charms.reactive import RelationBase from charms.reactive import hook from charms.reactive import scopes @@ -61,6 +62,8 @@ class KeystoneRequires(RelationBase): @hook('{requires:keystone-credentials}-relation-changed') def changed(self): self.update_state() + self.set_state('{relation_name}.available.updated') + hookenv.atexit(self._clear_updated) @hook('{requires:keystone-credentials}-relation-{broken,departed}') def departed(self): @@ -133,3 +136,6 @@ class KeystoneRequires(RelationBase): self.set_local(**relation_info) self.set_remote(**relation_info) + + def _clear_updated(self): + self.remove_state('{relation_name}.available.updated')