3
function f_juju1_get_model_name() {
4
# Determine Juju 1 model name to run with
5
juju_enviro_file="${HOME}/.juju/environments.yaml"
6
if [[ "$MOJO_SPEC" != *metal* ]]; then
11
JENV_NAME="$(grep '^default:' ${juju_enviro_file} | head -n1 | cut -f2 -d ':' | xargs)"
14
echo " . Juju proposed"
15
JENV_NAME="$(grep '.jprop:$' ${juju_enviro_file} | head -n1 | cut -f1 -d ':' | xargs)"
19
JENV_NAME="$(grep '.jdev:$' ${juju_enviro_file} | head -n1 | cut -f1 -d ':' | xargs)"
22
echo " ! Unknown JUJU_SOURCE value while determining jenv name."
23
echo "JUJU_SOURCE: $JUJU_SOURCE"
29
echo " . Handling juju environment switcher for bare metal..."
30
case "$JUJU_SOURCE" in
33
JENV_NAME="$(grep "maas-${UBUNTU_RELEASE}:$" ${juju_enviro_file} | head -n1 | cut -f1 -d ':' | xargs)"
36
echo " . Juju proposed"
37
JENV_NAME="$(grep .jprop:$ ${juju_enviro_file} | grep "maas-${UBUNTU_RELEASE}" | head -n1 | cut -f1 -d ':' | xargs)"
41
JENV_NAME="$(grep .jdev:$ ${juju_enviro_file} | grep "maas-${UBUNTU_RELEASE}" | head -n1 | cut -f1 -d ':' | xargs)"
44
echo " ! Unknown JUJU_SOURCE value while determining jenv name."
45
echo "JUJU_SOURCE: $JUJU_SOURCE"
51
# Validate as non-empty
52
if [[ -z "$JENV_NAME" ]]; then
53
echo " ! Could not determine an appropriate JENV_NAME."
54
echo "JUJU_SOURCE: $JUJU_SOURCE"
58
echo " . JUJU_SOURCE: $JUJU_SOURCE"
59
echo " . JENV_NAME: $JENV_NAME"
63
function XXX_f_collect_juju1_logs() {
64
# Collect juju stat and logs
65
echo "Collecting juju status and unit logs..."
67
# Check again before collecting logs
68
#f_juju_status_health_check "-collect" ||:
70
f_juju_stat "-collect" ||:
72
. $JENKINS_HOME/novarc
73
${OSCI_ROOT}/tools/nova_instances_summarize.py ||:
74
${OSCI_ROOT}/tools/juju_pull_logs.py ||:
78
function f_juju1_stat() {
79
juju stat --format=yaml &> $WORKSPACE/juju-stat-yaml${1}.txt ||:
80
juju stat --format=tabular &> $WORKSPACE/juju-stat-tabular${1}.txt ||:
84
function f_juju1_bootstrap() {
85
f_line "Bootstrapping juju with client: $(juju version), model: $(juju switch)"
86
echo " . Bootstrap parameters: $1 $2 $3 $4 $5"
87
juju bootstrap $1 $2 $3 $4 $5 2>&1 | tee $WORKSPACE/juju-bootstrap.txt
88
if [[ "${PIPESTATUS[0]}" != "0" ]]; then
89
echo " ! Bootstrap failed."
90
touch $WORKSPACE/fyi-${test:0:4}.${test}-bootstrap.failed