forked from vorburger/opendaylight-coe-kubernetes-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.sh
18 lines (17 loc) · 867 Bytes
/
utils.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash
get_private_IP() {
local NAME=$1
until openstack server list --name $NAME\$ | grep -q 'private='; do sleep 1 ; done
until openstack server show $NAME | grep -q 'ACTIVE'; do sleep 1 ; done
local IP=$(openstack server list --name $NAME\$ -c Networks --format value | sed 's/private=\([0-9.]\+\).*/\1/')
echo $IP
# ^^ NB Bash foo - must "echo" not "return" for non-numeric reply.
}
get_public_IP() {
local NAME=$1
until openstack server list --name $NAME\$ | grep -q 'private='; do sleep 1 ; done
until openstack server list --name $NAME\$ -c Networks --format value | grep -q ', '; do sleep 1 ; done
until openstack server show $NAME | grep -q 'ACTIVE'; do sleep 1 ; done
local IP=$(openstack server list --name $NAME\$ -c Networks --format value | sed 's/private=\([0-9.]\+\), \([0-9.]\+\)/\2/')
echo $IP
}