Be more robust on callbacks when cluster is down.
Be more robust on callbacks when cluster is down.

For 'on_stop' or 'on_restart' callbacks we cannot
call is_leader, because the cluster would be stopped.

Instead, call is_leader before running a callback.
In addition, make the call_nowait more robust by handling
the exceptions related to the DB cluster unavailability.

jinty/patroni,zalando/patroni,pgexperts/patroni,sean-/patroni,jinty/patroni,pgexperts/patroni,zalando/patroni,sean-/patroni