Arif Ali
e943d70891
* Add snap based juju-db for mongo status * Update latest vault secrets * fine tune fix_cloud.sh script to reduce the amount of commands to be run
21 lines
663 B
Bash
Executable File
21 lines
663 B
Bash
Executable File
#!/bin/bash
|
|
|
|
machine=${1:-0}
|
|
model=${2:-controller}
|
|
|
|
read -d '' -r cmds <<'EOF'
|
|
user=$(sudo ls /var/lib/juju/agents/ | grep machine)
|
|
conf=/var/lib/juju/agents/${user}/agent.conf
|
|
password=$(sudo grep statepassword ${conf} | cut -d' ' -f2)
|
|
if [ -f /usr/lib/juju/mongo*/bin/mongo ]; then
|
|
client=/usr/lib/juju/mongo*/bin/mongo
|
|
elif [ -f /usr/bin/mongo ]; then
|
|
client=/usr/bin/mongo
|
|
else
|
|
client=/snap/bin/juju-db.mongo
|
|
fi
|
|
${client} 127.0.0.1:37017/juju --authenticationDatabase admin --ssl --sslAllowInvalidCertificates --username "${user}" --password "${password}" --eval "rs.status()" | grep -P '(name|stateStr)'
|
|
EOF
|
|
|
|
juju ssh -m ${model} ${machine} "${cmds}"
|