Fix PREFIX parsing of ifcfg file 95/14795/1
authorFeng Pan <fpan@redhat.com>
Sat, 28 May 2016 00:53:01 +0000 (20:53 -0400)
committerFeng Pan <fpan@redhat.com>
Sat, 28 May 2016 00:53:01 +0000 (20:53 -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: Ic251a3a92bf4d318bb41114e15911f5e51dd2cde
Signed-off-by: Feng Pan <fpan@redhat.com>
lib/common-functions.sh

index dfac008..d01f791 100644 (file)
@@ -154,7 +154,7 @@ function detach_interface_from_ovs {
       if_dns2=$(sed -n 's/^DNS2=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
 
       if [ -z "$if_mask" ]; then
-        if_prefix=$(sed -n 's/^PREFIX=\(.*\)$/\1/p' ${net_path}/ifcfg-${bridge})
+        if_prefix=$(sed -n 's/^PREFIX=[^0-9]*\([0-9][0-9]*\)[^0-9]*$/\1/p' ${net_path}/ifcfg-${bridge})
         if_mask=$(prefix2mask ${if_prefix})
       fi