KeyError for leader unit during cluster-relation-joined
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-repository-cache (Juju Charms Collection) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
This Traceback was found during is-mojo-ci testing of the archive-mirror specs [1].
I also saw it during my testing and was able to determine that yes, the relation for the leader unit is missing. Here's the Traceback:
2017-02-11 02:13:38 INFO juju-log cluster:2: Cluster relation joined for ubuntu-
2017-02-11 02:13:38 INFO juju-log cluster:2: Generating new SSH key for user www-sync.
2017-02-11 02:13:38 INFO juju-log cluster:2: Updating metadata on a peer
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 INFO cluster-
2017-02-11 02:13:39 ERROR juju.worker.
Debugging this showed that the relation list contained ubuntu-
Thinking about this a bit, units join relations and leadership elections are all asynchronous events. As a result, there is no gaurantee that the leader unit has joined this peer relation yet. I tried the following just prior to line 202 in mirror.py.
if leader_id not in rel:
LOG('Leader {} not yet related'
return
After the hook was retried, the exception no longer blocked the hook from completion. The leader unit then joined on a subsequent cluster-
I have some changes in progress and will propose an MP shortly.
[1] https:/
Changed in ubuntu-repository-cache (Juju Charms Collection): | |
status: | New → Fix Released |