Fix PREFIX calculation for attach_interface_to_ovs 97/22397/1
authorFeng Pan <fpan@redhat.com>
Fri, 23 Sep 2016 16:14:44 +0000 (12:14 -0400)
committerFeng Pan <fpan@redhat.com>
Fri, 23 Sep 2016 16:14:44 +0000 (12:14 -0400)
Make sure we only get number portion of PREFIX in ifcfg file, this
avoids getting potentially the double quotes around the prefix.

JIRA: APEX-163

Change-Id: Ia59a437927a75d9bb99efd324ccb5e4a5201c051
Signed-off-by: Feng Pan <fpan@redhat.com>
lib/common-functions.sh

index 6941093..4dd8a13 100644 (file)
@@ -72,7 +72,7 @@ function attach_interface_to_ovs {
 
   if [ -z "$if_mask" ]; then
     # we can look for PREFIX here, then convert it to NETMASK
-    if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${if_file})
+    if_prefix=$(sed -n 's/^PREFIX=[^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1/p' ${if_file})
     if_mask=$(prefix2mask ${if_prefix})
   fi