From 9b46e06062842a78a71d41c1d8fecbc061eddc26 Mon Sep 17 00:00:00 2001 From: Vladimir Kozhukalov Date: Thu, 31 Aug 2023 01:28:23 +0300 Subject: [PATCH] Fix getting IP when there are multiple IPs assigned Story: 2003851 Task: 26644 Change-Id: I425dac241cbf454d91c644e7d2ef65625f70e01c --- neutron/Chart.yaml | 2 +- neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl | 2 +- neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl | 4 ++-- releasenotes/notes/neutron.yaml | 1 + 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/neutron/Chart.yaml b/neutron/Chart.yaml index 83b35db4d3..0e2651f3b8 100644 --- a/neutron/Chart.yaml +++ b/neutron/Chart.yaml @@ -14,7 +14,7 @@ apiVersion: v1 appVersion: v1.0.0 description: OpenStack-Helm Neutron name: neutron -version: 0.3.18 +version: 0.3.19 home: https://docs.openstack.org/neutron/latest/ icon: https://www.openstack.org/themes/openstack/images/project-mascots/Neutron/OpenStack_Project_Neutron_vertical.png sources: diff --git a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl index ed9518978f..f46d9a3ea2 100644 --- a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl @@ -46,7 +46,7 @@ if [ -z "${tunnel_interface}" ] ; then fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null -LOCAL_IP=$(ip a s $tunnel_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}') +LOCAL_IP=$(ip a s $tunnel_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" 'NR==1 {print $1}') if [ -z "${LOCAL_IP}" ] ; then echo "Var LOCAL_IP is empty" exit 1 diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index 3283e09e7c..0ac9725f68 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -65,7 +65,7 @@ function get_name_by_pci_id { function get_ip_address_from_interface { local interface=$1 - local ip=$(ip -4 -o addr s "${interface}" | awk '{ print $4; exit }' | awk -F '/' '{print $1}') + local ip=$(ip -4 -o addr s "${interface}" | awk '{ print $4; exit }' | awk -F '/' 'NR==1 {print $1}') if [ -z "${ip}" ] ; then exit 1 fi @@ -74,7 +74,7 @@ function get_ip_address_from_interface { function get_ip_prefix_from_interface { local interface=$1 - local prefix=$(ip -4 -o addr s "${interface}" | awk '{ print $4; exit }' | awk -F '/' '{print $2}') + local prefix=$(ip -4 -o addr s "${interface}" | awk '{ print $4; exit }' | awk -F '/' 'NR==1 {print $2}') if [ -z "${prefix}" ] ; then exit 1 fi diff --git a/releasenotes/notes/neutron.yaml b/releasenotes/notes/neutron.yaml index 26b435afa2..508556eccd 100644 --- a/releasenotes/notes/neutron.yaml +++ b/releasenotes/notes/neutron.yaml @@ -60,4 +60,5 @@ neutron: - 0.3.16 Use service tokens - 0.3.17 Add exec probe timeouts - 0.3.18 Improve OVN support + - 0.3.19 Fix getting IP for interface when there are multiple IPs assigned ...