~james-page/ubuntu-openstack-ci/drop-tox-from-slave-config

« back to all changes in this revision

Viewing changes to run/job-parts/deprecated/osci_juju1_common.sh

  • Committer: Ryan Beisner
  • Date: 2018-12-13 21:10:41 UTC
  • mto: This revision was merged to the branch mainline in revision 409.
  • Revision ID: ryan.beisner@canonical.com-20181213211041-5xw4jn4u17ujbv6o
Actually remove the deprecated things

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash -e
2
 
 
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
7
 
    # Not bare metal
8
 
    case "$JUJU_SOURCE" in
9
 
      $JUJU_STABLE)
10
 
        echo " . Juju stable"
11
 
        JENV_NAME="$(grep '^default:' ${juju_enviro_file} | head -n1 | cut -f2 -d ':' | xargs)"
12
 
        ;;
13
 
      $JUJU_PROPOSED)
14
 
        echo " . Juju proposed"
15
 
        JENV_NAME="$(grep '.jprop:$' ${juju_enviro_file} | head -n1 | cut -f1 -d ':' | xargs)"
16
 
        ;;
17
 
      $JUJU_DEVEL)
18
 
        echo " . Juju devel"
19
 
        JENV_NAME="$(grep '.jdev:$' ${juju_enviro_file} | head -n1 | cut -f1 -d ':' | xargs)"
20
 
        ;;
21
 
      *)
22
 
        echo " ! Unknown JUJU_SOURCE value while determining jenv name."
23
 
        echo "JUJU_SOURCE: $JUJU_SOURCE"
24
 
        exit 1
25
 
        ;;
26
 
    esac
27
 
  else
28
 
    # Bare metal
29
 
    echo " . Handling juju environment switcher for bare metal..."
30
 
    case "$JUJU_SOURCE" in
31
 
      $JUJU_STABLE)
32
 
        echo " . Juju stable"
33
 
        JENV_NAME="$(grep "maas-${UBUNTU_RELEASE}:$" ${juju_enviro_file} | head -n1 | cut -f1 -d ':' | xargs)"
34
 
        ;;
35
 
      $JUJU_PROPOSED)
36
 
        echo " . Juju proposed"
37
 
        JENV_NAME="$(grep .jprop:$ ${juju_enviro_file} | grep "maas-${UBUNTU_RELEASE}" | head -n1 | cut -f1 -d ':' | xargs)"
38
 
        ;;
39
 
      $JUJU_DEVEL)
40
 
        echo " . Juju devel"
41
 
        JENV_NAME="$(grep .jdev:$ ${juju_enviro_file} | grep "maas-${UBUNTU_RELEASE}" | head -n1 | cut -f1 -d ':' | xargs)"
42
 
        ;;
43
 
      *)
44
 
        echo " ! Unknown JUJU_SOURCE value while determining jenv name."
45
 
        echo "JUJU_SOURCE: $JUJU_SOURCE"
46
 
        exit 1
47
 
        ;;
48
 
    esac
49
 
  fi
50
 
 
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"
55
 
    exit 1
56
 
  fi
57
 
  export JENV_NAME
58
 
  echo " . JUJU_SOURCE: $JUJU_SOURCE"
59
 
  echo " . JENV_NAME: $JENV_NAME"
60
 
}
61
 
 
62
 
 
63
 
function XXX_f_collect_juju1_logs() {
64
 
# Collect juju stat and logs
65
 
  echo "Collecting juju status and unit logs..."
66
 
 
67
 
  # Check again before collecting logs
68
 
  #f_juju_status_health_check "-collect" ||:
69
 
 
70
 
  f_juju_stat "-collect" ||:
71
 
 
72
 
  . $JENKINS_HOME/novarc
73
 
  ${OSCI_ROOT}/tools/nova_instances_summarize.py ||:
74
 
  ${OSCI_ROOT}/tools/juju_pull_logs.py ||:
75
 
}
76
 
 
77
 
 
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 ||:
81
 
}
82
 
 
83
 
 
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
91
 
  fi
92
 
}