Skip to content

Commit

Permalink
New openstack CLI tooling changed network output. (#320)
Browse files Browse the repository at this point in the history
Rather than networkname=IP, IP we now have 'networkname': ['IP', 'IP']
as output from server list. Parse both.

Signed-off-by: Kurt Garloff <[email protected]>
  • Loading branch information
garloff committed May 1, 2023
1 parent 51ae3d5 commit 0ff6e12
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions terraform/files/bin/remove_cluster-network.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export KUBECONFIG=~/.kube/config
MGMT="$PREFIX-mgmtcluster"
MGMTNET=$(openstack server list --name "$MGMT" -f value -c Networks)
NET=$(echo "$MGMTNET" | grep "k8s-clusterapi-cluster-default-$CLUSTER_NAME=" | sed "s/.*k8s-clusterapi-cluster-default-$CLUSTER_NAME=\([0-9a-f:\.]*\).*\$/\1/")
# New format
if test -z "$NET"; then NET=$(echo "$MGMTNET" | grep "'k8s-clusterapi-cluster-default-$CLUSTER_NAME':" | sed "s/.*'k8s-clusterapi-cluster-default-$CLUSTER_NAME':[^']*'\([0-9a-f:\.]*\)'.*\$/\1/"); fi
if test -z "$NET"; then echo "No network to remove ..."; exit 1; fi
NIC=$(ip addr | grep -B4 "inet $NET/" | grep '^[0-9]' | sed 's/^[0-9]*: \([^: ]*\): .*$/\1/')

Expand Down

0 comments on commit 0ff6e12

Please sign in to comment.