~andrewjbeach/juju-ci-tools/make-local-patcher

« back to all changes in this revision

Viewing changes to test-restricted-network

  • Committer: Aaron Bentley
  • Date: 2015-06-15 19:04:10 UTC
  • mfrom: (976.2.4 fix-log-rotation)
  • Revision ID: aaron.bentley@canonical.com-20150615190410-vvhtl7yxn0xbtbiy
Fix error handling in assess_log_rotation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
JUJU_HOME="$HOME/.juju"
4
4
AMI_IMAGE=""
5
5
SERIES=""
6
 
REVISION_BUILD="lastSuccessfulBuild"
7
6
while [[ "${1-}" != "" && $1 =~ ^-.*  ]]; do
8
7
    case $1 in
9
8
        --juju-home)
18
17
            shift
19
18
            SERIES=$1
20
19
            ;;
21
 
        --revision-build)
22
 
            shift
23
 
            REVISION_BUILD=$1
24
 
            ;;
25
20
    esac
26
21
    shift
27
22
done
41
36
export PATH="$SCRIPTS:$PATH"
42
37
source $JUJU_HOME/ec2rc
43
38
mkdir -p bash
44
 
$SCRIPTS/jujuci.py get -a -b $REVISION_BUILD build-revision buildvars.bash bash
 
39
$SCRIPTS/jujuci.py get -a build-revision buildvars.bash bash
45
40
source bash/buildvars.bash
46
41
ec2-terminate-job-instances
47
42
set -x
56
51
ARCH=$(ssh -o 'StrictHostKeyChecking no' -o 'UserKnownHostsFile /dev/null' \
57
52
    ubuntu@$instance_name dpkg --print-architecture)
58
53
 
 
54
juju_local_deb="juju-local_$VERSION-0ubuntu1~$RELEASE.1~juju1_all.deb"
 
55
juju_core_deb="juju-core_$VERSION-0ubuntu1~$RELEASE.1~juju1_$ARCH.deb"
 
56
 
59
57
if [ -e debs ]; then
60
58
  rm -R debs
61
59
fi
62
60
mkdir -p debs
63
 
$SCRIPTS/s3ci.py get \
64
 
    $revision_build build-binary-trusty-$ARCH 'juju.*\.deb' debs
 
61
$SCRIPTS/jujuci.py get publish-revision $juju_local_deb debs
 
62
$SCRIPTS/jujuci.py get publish-revision $juju_core_deb debs
65
63
 
66
64
scp -o 'StrictHostKeyChecking no' -o 'UserKnownHostsFile /dev/null' \
67
 
  debs/*.deb ubuntu@$instance_name:
 
65
  debs/$juju_local_deb debs/$juju_core_deb ubuntu@$instance_name:
68
66
 
69
67
set +e
70
68
ssh -o "StrictHostKeyChecking no" -o "UserKnownHostsFile /dev/null" \
71
 
    ubuntu@$instance_name "SERIES=$SERIES bash"<<"EOT"
 
69
    ubuntu@$instance_name "SERIES=$SERIES juju_local_deb=$juju_local_deb\
 
70
    juju_core_deb=$juju_core_deb bash"<<"EOT"
72
71
set -eux
73
72
for attempt in $(seq 10); do
74
73
  if grep ec2.archive.ubuntu.com /etc/apt/sources.list > /dev/null; then
90
89
# prevent spurious failure on success
91
90
rm .bash_logout
92
91
afact=lastSuccessfulBuild/artifact
93
 
sudo dpkg -i *.deb || true
 
92
sudo dpkg -i $juju_core_deb $juju_local_deb || true
94
93
sudo apt-get install -y -f
95
94
export JUJU_REPOSITORY="$HOME/repo"
96
95
mkdir -p $JUJU_REPOSITORY/$SERIES
142
141
done
143
142
for x in $(seq 30); do
144
143
  # relying on the indentation of ubuntu/0's agent-state here...
145
 
  # but current: idle matches only the unit of the ubuntu service.
146
 
  if juju status  --format yaml | grep -E ' {8}agent-state: started|current: idle'; then
 
144
  if juju status | grep -E ' {8}agent-state: started'; then
147
145
    exit 0;
148
146
  fi
149
147
  sleep 10
150
148
done
151
 
juju status --format yaml
 
149
juju status
152
150
report_network "The failing network conditions:"
153
151
# Restore some routing so that staff can do an autopsy
154
152
sudo route add default gw $gateway eth0