#!/bin/bash check_controller() { controller=$1 model="cpe-focal" juju status -m ${controller}:${model} --color | grep ^Unit -A 999999 | egrep -v "started.*focal|started.*bionic|active.*idle" } if [[ -z "$1" ]] ; then check_controller $(juju controllers --format json | jq .\"current-controller\" | sed s/\"//g) else check_controller $1 fi