From: Feng Pan Date: Sat, 28 May 2016 00:53:01 +0000 (-0400) Subject: Fix PREFIX parsing of ifcfg file X-Git-Tag: colorado.1.0~216 X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F95%2F14795%2F1;p=apex.git Fix PREFIX parsing of ifcfg file 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 --- diff --git a/lib/common-functions.sh b/lib/common-functions.sh index dfac008e..d01f7918 100644 --- a/lib/common-functions.sh +++ b/lib/common-functions.sh @@ -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