Files
sos_testing/sos_collect_testing.sh
2024-08-13 21:43:24 +01:00

52 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
deb_type="proposed"
sleep=5
num_of_nodes=4
declare -A all_series
all_series=(
['focal']="ubuntu:focal"
['jammy']="ubuntu:jammy"
['noble']="ubuntu:noble"
)
for series in "${!all_series[@]}"
do
model="${series}-sos"
juju add-model ${model}
juju model-config cloudinit-userdata="$(cat sos_collect_user-data.yaml)"
juju add-ssh-key "$(cat ~/.ssh/aarsa4096canonical.pub)"
if [[ ${series} == "noble" ]] ; then
juju add-machine --series ${series} -n ${num_of_nodes}
else
juju deploy ubuntu --series ${series} -n ${num_of_nodes} --force
fi
juju-wait -m ${model}
# wait for package to finish install
echo Sleeping for ${sleep} seconds for cloud-init to finish
sleep ${sleep}
if [[ "${deb_type}" == "proposed" ]] ; then
juju run --all -- 'sudo bash /root/enable_proposed.sh'
elif [[ "${deb_type}" == "ppa" ]] ; then
juju run --all -- 'sudo bash /root/enable_ppa.sh'
fi
juju run --all -- sudo apt -y install sosreport
juju run --all -- dpkg -l sosreport
if [[ ${series} == "noble" ]] ; then
sos collect --cluster-type juju --no-local -c "juju.machines=$(seq -s, 0 $((num_of_nodes-1)))" --batch --case-id 3524678 --all-logs -a > sos_collect_${series}.log 2>&1
else
sos collect --cluster-type juju --no-local -c "juju.apps=ubuntu" --batch --case-id 3524678 --all-logs -a > sos_collect_${series}.log 2>&1
fi
juju destroy-model -y ${model}
done