You are going to want some better instrumentation. The leader-elected hook is not run when the unit becomes leader. It is run some time after the unit has become leader, and as far as I know there is no guarantee that it is still the leader when it happens. I'd stick an 'assert is_leader()' in the leader_set wrapper, possibly by monkey patching charmhelpers.core.hookenv.leader_set()
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1654116 Title: Attempts to write leadership settings when not the leader during relation-changed hooks To manage notifications about this bug go to: https://bugs.launchpad.net/autopilot-log-analyser/+bug/1654116/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs