24 lines
692 B
Bash
Executable File
24 lines
692 B
Bash
Executable File
#!/bin/bash
|
|
|
|
default_model="cpe-jammy"
|
|
|
|
check_controller()
|
|
{
|
|
controller=$1
|
|
model="$2"
|
|
|
|
juju status -m "${controller}":${model} --color | grep "Unit " -A 999999 | grep -E -v "started.*bionic|started.*focal|started.*ubuntu@|active.*idle"
|
|
|
|
}
|
|
|
|
if [[ -z "$1" ]] && [[ -z $2 ]] ; then
|
|
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")"
|
|
elif [[ -z "$1" ]]; then
|
|
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")" "${default_model}"
|
|
elif [[ -z "$2" ]]; then
|
|
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")" "${default_model}"
|
|
else
|
|
check_controller "${1}" "${2}"
|
|
fi
|
|
|