m/n/c/curator: fix panic caused by race

The starting/stopping of the respective follower/leader implementations
is not synchronized with the state event source. Thus it can happen that
requests get routed to an improper implementation. The follower
correctly rejected requests when the current state indicated that it was
a leader, but panic'ed if it was neither which is a valid state.

Reject requests when it is not a follower, not just if it is a leader.

Change-Id: I5cee85a44cb8a1ce1f4f28c49930abd1d14ac4e1
Reviewed-on: https://review.monogon.dev/c/monogon/+/3782
Reviewed-by: Jan Schär <jan@monogon.tech>
Tested-by: Jenkins CI
diff --git a/metropolis/node/core/curator/impl_follower.go b/metropolis/node/core/curator/impl_follower.go
index ac68e6d..1df859c 100644
--- a/metropolis/node/core/curator/impl_follower.go
+++ b/metropolis/node/core/curator/impl_follower.go
@@ -34,8 +34,8 @@
 			return err
 		}
 
-		if st.leader != nil {
-			return status.Errorf(codes.Unavailable, "node became leader, try again")
+		if st.follower == nil {
+			return status.Errorf(codes.Unavailable, "election status changed, try again")
 		}
 
 		lock := st.follower.lock