Created
June 1, 2017 17:28
-
-
Save carlosedp/f2dc8e184ed8cafb6fc71013f0d37bff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Set the lb id | |
LB_ID=$1 | |
read -p "Do you really want to delete LB \"${LB_ID}\"? " -n 1 -r | |
echo # new line | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
listeners=($(neutron lbaas-loadbalancer-show ${LB_ID} --format json |grep listeners| grep -o '[a-f0-9-]\{36\}')) | |
pools=($(neutron lbaas-loadbalancer-show ${LB_ID} --format json |grep pools| grep -o '[a-f0-9-]\{36\}')) | |
health=($(neutron lbaas-loadbalancer-show ${LB_ID} --format json |grep healthmonitor_id| grep -o '[a-f0-9-]\{36\}')) | |
for i in ${health[@]} | |
do | |
echo "Deleting healthmonitor $i" | |
neutron lbaas-healthmonitor-delete "$i" | |
done | |
for i in ${pools[@]} | |
do | |
echo "Deleting pool $i" | |
neutron lbaas-pool-delete "$i" | |
done | |
for i in ${listeners[@]} | |
do | |
echo "Deleting listener $i" | |
neutron lbaas-listener-delete "$i" | |
done | |
echo "Deleting loadbalancer ${LB_ID}" | |
neutron lbaas-loadbalancer-delete "${LB_ID}" | |
echo "Done!" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment