Fix openstack port show content handling
openstackclient 4.0.0 introduced in I9878f327e39f56852cc0fb6e4eee9105b7141da9 a new format for displaying columns with complex python types. It breaks our devstack plugin because we rely on 'openstack port show -c fixed_ips -f value' to find the ip address of our management port. This commit fixes the parsing of openstack port show command. Change-Id: I6c5ebdea8149166f8d0ebb69cfe63692892f5ab9
This commit is contained in:
parent
2eac7a7862
commit
926179c97d
@ -384,8 +384,7 @@ function create_mgmt_network_interface {
|
||||
MGMT_PORT_ID=$(openstack port create --security-group lb-health-mgr-sec-grp --device-owner Octavia:health-mgr --host=$(hostname) -c id -f value --network lb-mgmt-net $PORT_FIXED_IP octavia-health-manager-$OCTAVIA_NODE-listen-port)
|
||||
MGMT_PORT_MAC=$(openstack port show -c mac_address -f value $MGMT_PORT_ID)
|
||||
|
||||
# TODO(johnsom) This gets the IPv4 address, should be updated for IPv6
|
||||
MGMT_PORT_IP=$(openstack port show -f value -c fixed_ips $MGMT_PORT_ID | awk '{FS=",| "; gsub(",",""); gsub("'\''",""); for(i = 1; i <= NF; ++i) {if ($i ~ /^ip_address/) {n=index($i, "="); if (substr($i, n+1) ~ "\\.") print substr($i, n+1)}}}')
|
||||
MGMT_PORT_IP=$(openstack port show -f yaml -c fixed_ips $MGMT_PORT_ID | awk '{FS=",|";gsub(",","");gsub("'\''","");for(line = 1; line <= NF; ++line) {if ($line ~ /^- ip_address:/) {split($line, word, " ");if (ENVIRON["IPV6_ENABLED"] == "" && word[3] ~ /\./) print word[3];if (ENVIRON["IPV6_ENABLED"] != "" && word[3] ~ /:/) print word[3];} else {split($line, word, " ");for(ind in word) {if (word[ind] ~ /^ip_address=/) {split(word[ind], token, "=");if (ENVIRON["IPV6_ENABLED"] == "" && token[2] ~ /\./) print token[2];if (ENVIRON["IPV6_ENABLED"] != "" && token[2] ~ /:/) print token[2];}}}}}')
|
||||
if function_exists octavia_create_network_interface_device ; then
|
||||
octavia_create_network_interface_device o-hm0 $MGMT_PORT_ID $MGMT_PORT_MAC
|
||||
elif [[ $NEUTRON_AGENT == "openvswitch" || $Q_AGENT == "openvswitch" ]]; then
|
||||
|
Loading…
Reference in New Issue
Block a user