4
# Delete the contents of /var/lib/jenkins/images from the jenkins master and all jenkins slaves (!!)
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"
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'"
23
echo " Not deleting, just listing:"
24
juju ssh $unit "sudo ls -al /var/lib/jenkins/images || echo 'No Images Dir'"