X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Fcharmed_uninstall.sh;h=09305d2ad82cba31a8f4313113b8484688bd2a8d;hb=ce7b460470a5a68524533472dbb12beb5376281a;hp=6cee999fe0efb2517b058e4a52a234564105826f;hpb=47cd3b277310d5d6fef0067f220e849bebff35b4;p=osm%2Fdevops.git diff --git a/installers/charmed_uninstall.sh b/installers/charmed_uninstall.sh index 6cee999f..09305d2a 100755 --- a/installers/charmed_uninstall.sh +++ b/installers/charmed_uninstall.sh @@ -12,28 +12,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # -function remove_iptables() { - stack=$1 - if [ -z "$OSM_VCA_HOST" ]; then - OSM_VCA_HOST=`sg lxd -c "juju show-controller controller"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'` - [ -z "$OSM_VCA_HOST" ] && FATAL "Cannot obtain juju controller IP address" - fi - if [ -z "$DEFAULT_IP" ]; then - DEFAULT_IF=`route -n |awk '$1~/^0.0.0.0/ {print $8}'` - [ -z "$DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0" - DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'` - [ -z "$DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route" - fi - if sudo iptables -t nat -C PREROUTING -p tcp -m tcp -d $DEFAULT_IP --dport 17070 -j DNAT --to-destination $OSM_VCA_HOST; then - sudo iptables -t nat -D PREROUTING -p tcp -m tcp -d $DEFAULT_IP --dport 17070 -j DNAT --to-destination $OSM_VCA_HOST - sudo netfilter-persistent save - fi -} - -remove_iptables -juju destroy-model osm-on-k8s --destroy-storage -juju destroy-model test --destroy-storage +juju destroy-model osm --destroy-storage -y --force --no-wait sudo snap unalias osm sudo snap remove osmclient +CONTROLLER_NAME="osm-vca" +CONTROLLER_PRESENT=$(juju controllers 2>/dev/null| grep ${CONTROLLER_NAME} | wc -l) +if [[ $CONTROLLER_PRESENT -ge 1 ]]; then + cat << EOF +The VCA with the name "${CONTROLLER_NAME}" has been left in place to ensure that no other +applications are using it. If you are sure you wish to remove this controller, +please execute the following command: + + juju destroy-controller --release-storage --destroy-all-models -y ${CONTROLLER_NAME} + +EOF +fi