2023-02-22 14:16:27 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-10-21 15:03:07 +00:00
|
|
|
. functions.sh
|
|
|
|
check_juju_version
|
2023-06-19 13:45:13 +00:00
|
|
|
|
2023-02-22 14:16:27 +00:00
|
|
|
check_controller()
|
|
|
|
{
|
|
|
|
controller=$1
|
2024-10-21 15:03:07 +00:00
|
|
|
model="${controller}:${model_name}"
|
2023-02-22 14:16:27 +00:00
|
|
|
|
2023-06-19 13:45:13 +00:00
|
|
|
RW_MYSQL_UNIT=$(juju status -m ${model} --format json | jq -r '[.applications."mysql-innodb-cluster".units | to_entries[]| select(.value."workload-status".message | contains("R/W")) | .key] | .[0]')
|
2024-10-21 15:03:07 +00:00
|
|
|
${juju_run_action} -m ${model} ${RW_MYSQL_UNIT} cluster-status --format json | jq -rc '.[].results."cluster-status"' | jq
|
2023-02-22 14:16:27 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if [[ -z "$1" ]] ; then
|
|
|
|
check_controller "$(juju controllers --format json | jq -r .\"current-controller\")"
|
|
|
|
else
|
|
|
|
check_controller "${1}"
|
|
|
|
fi
|