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

« back to all changes in this revision

Viewing changes to operate/deprecated/930-images-delete.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
 
echo $0
3
 
 
4
 
# Delete the contents of /var/lib/jenkins/images from the jenkins master and all jenkins slaves (!!)
5
 
 
6
 
param=$1
7
 
 
8
 
if [ -z "$param" ]; then
9
 
  echo "Deletes the ~/images contents on all jenkins units!"
10
 
  echo "Potentially dangerous, so you must confirm with YES."
11
 
  echo "Usage:  <this script> YES"
12
 
  sleep 2
13
 
fi
14
 
 
15
 
# Get jenkins units
16
 
units=$(juju status --format=yaml | egrep "osci[-]?(slave|lab|task)?/[0-9]{1,10}:" \
17
 
    | cut -d ":" -f 1 | sed 's/^ *//')
18
 
for unit in $units; do
19
 
  echo "----- ${unit} -----"
20
 
  if [ "$param" == "YES" ]; then
21
 
    juju ssh $unit "sudo ls -al /var/lib/jenkins/images && sudo rm -fv /var/lib/jenkins/images/* || echo 'No Images Dir'"
22
 
  else
23
 
    echo "  Not deleting, just listing:"
24
 
    juju ssh $unit "sudo ls -al /var/lib/jenkins/images || echo 'No Images Dir'"
25
 
  fi
26
 
done
27