pub fn block_until_leader() -> Result<(), failure::Error> {
    if Path::new("/etc/podinfo/labels").exists() {
        info!("Kubernetes detected, checking if node is leader");
        loop {
            let result = Command::new("kube-is-leader.sh")
                .output()
                .expect("Failed to check if node is leader");
            if result.status.success() {
                break;
            }
            std::thread::sleep(LEADER_LOOKUP_INTERVAL);
        }
    } else {
        info!("No kubernetes detected, node is selected as leader")
    }
    info!("Node is selected as leader");
    Ok(())
}
/// Blocks thread until node is leader .
///
/// # Panics
///
/// Panics on failed connection to db.
Blocks thread until node is leader .
Blocks thread until node is leader .
pub fn block_until_leader() -> Result<(), failure::Error> {
    if Path::new("/etc/podinfo/labels").exists() {
        info!("Kubernetes detected, checking if node is leader");
        loop {
            let result = Command::new("kube-is-leader.sh")
                .output()
                .expect("Failed to check if node is leader");
            if result.status.success() {
                break;
            }
            std::thread::sleep(LEADER_LOOKUP_INTERVAL);
        }
    } else {
        info!("No kubernetes detected, node is selected as leader")
    }
    info!("Node is selected as leader");
    Ok(())
}
pub fn block_until_leader ( ) -> Result < ( ) , failure :: Error > { if Path :: new ( " " ) . exists ( ) { info ! ( " " ) ; loop { let result = Command :: new ( " " ) . output ( ) . expect ( " " ) ; if result . status . success ( ) { break ; } std :: thread :: sleep ( LEADER_LOOKUP_INTERVAL ) ; } } else { info ! ( " " ) } info ! ( " " ) ; Ok ( ( ) ) }
Blocks thread until node is leader .
Blocks thread until node is leader .
panics
Panics on failed connection to db.
Panics on failed connection to db .