From 6b917043c62e851f370b105d13265b9e1c1b5211 Mon Sep 17 00:00:00 2001
From: Matt McEuen <madgin@madgin.net>
Date: Wed, 12 Jul 2017 21:00:22 -0500
Subject: [PATCH] Fix OVS tunnel interface grep

Hardened the grep/awk that extracts the default interface for use
as the tunneling interface.  The command failed on multiple
Ubuntu machines as-was.

Change-Id: Ib7d0a8e55e67391d6cb7a58910cfc2ed617a4cbc
---
 neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl
index 9046dadda8..c8e0ca6a42 100644
--- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl
+++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl
@@ -30,7 +30,7 @@ timeout 3m neutron-sanity-check --config-file /etc/neutron/neutron.conf --config
 tunnel_interface="{{- .Values.network.interface.tunnel -}}"
 if [ -z "${tunnel_interface}" ] ; then
     # search for interface with default routing
-    tunnel_interface=$(ip r | grep default | grep -oP '(?<=dev ).*')
+    tunnel_interface=$(ip route | awk '/^default/ { print $5 }' | head -1 )
 fi
 
 # determine local-ip dynamically based on interface provided but only if tunnel_types is not null