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

« back to all changes in this revision

Viewing changes to operate/deprecated/955-float-ip-delete-unassociated.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
 
# DANGEROUS!!  delete all floating IPs which don't match
5
 
 
6
 
param=$1
7
 
 
8
 
if [ -z "$param" ]; then
9
 
  echo "Delete all unassociated floating IP addressses."
10
 
  echo "Potentially dangerous, so you must confirm with YES."
11
 
  echo "Usage:  (this_script_name).sh YES"
12
 
fi
13
 
 
14
 
 
15
 
dont_delete="10\.5\."
16
 
 
17
 
fips="$(nova floating-ip-list |  grep -v "${dont_delete}" | grep '\.' | awk '{ print $2 }')"
18
 
 
19
 
for ip in ${fips}; do
20
 
    if [ "$param" == "YES" ]; then
21
 
        echo "Deleting: ${ip}!"
22
 
        nova floating-ip-delete ${ip}
23
 
    else
24
 
        echo "Dry run, would have deleted: ${ip}!"
25
 
    fi
26
 
done