Function juju::is_leader [] [src]

pub fn is_leader() -> Result<bool, JujuError>

Returns true/false if this unit is the leader

Failures

Will return stderr as a String if the function fails to run

Examples

extern crate juju;
let leader = match juju::is_leader(){
  Ok(l) => l,
  Err(e) => {
    println!("Failed to run.  Error was {:?}", e);
    //Bail
    return;
  },
};
if leader{
  println!("I am the leader!");
}else{
  println!("I am not the leader.  Maybe later I will be promoted");
}