Skip to content

Commit 5717c5d

Browse files
authored
Merge pull request sonic-net#300 from saiarcot895/fix-config-setting-with-existing-values
Fix setting a config with an already-existing conflicting value
2 parents 34f26b3 + 7f8d898 commit 5717c5d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

manage-config

+5-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ if [ -e ${exclusion_file} -o -e ${inclusion_file} -o -e ${force_inclusion_file}
7979
inclusion_opts=$(get_section_opts ${inclusion_file} "common" ${ARCH} ${PLATFORM})
8080
while read -r opt; do
8181
if [ ! -z "$opt" ] && [[ ! "$opt" =~ ^#.* ]]; then
82-
echo $opt >> ${CONFIG_FILE}
82+
n=${opt%=*}
83+
v="${opt#*=}"
84+
scripts/config --file ${CONFIG_FILE} -k --set-val "$n" "$v"
8385
fi
8486
done <<< ${inclusion_opts};
8587
fi
@@ -113,6 +115,8 @@ if [ -e ${exclusion_file} -o -e ${inclusion_file} -o -e ${force_inclusion_file}
113115
if [ ! -z "$opt" ] && [[ ! "$opt" =~ ^#.* ]]; then
114116
n=${opt%=*}
115117
v="${opt#*=}"
118+
v="${v/#\"/}"
119+
v="${v/%\"/}"
116120
s=$(scripts/config --file ${CONFIG_FILE} -k --state $n)
117121
if [ ! "$s" = "$v" ]; then
118122
ret=2

0 commit comments

Comments
 (0)