Skip to content

Commit

Permalink
Merge pull request sonic-net#300 from saiarcot895/fix-config-setting-…
Browse files Browse the repository at this point in the history
…with-existing-values

Fix setting a config with an already-existing conflicting value
  • Loading branch information
saiarcot895 authored Dec 9, 2022
2 parents 34f26b3 + 7f8d898 commit 5717c5d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manage-config
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ if [ -e ${exclusion_file} -o -e ${inclusion_file} -o -e ${force_inclusion_file}
inclusion_opts=$(get_section_opts ${inclusion_file} "common" ${ARCH} ${PLATFORM})
while read -r opt; do
if [ ! -z "$opt" ] && [[ ! "$opt" =~ ^#.* ]]; then
echo $opt >> ${CONFIG_FILE}
n=${opt%=*}
v="${opt#*=}"
scripts/config --file ${CONFIG_FILE} -k --set-val "$n" "$v"
fi
done <<< ${inclusion_opts};
fi
Expand Down Expand Up @@ -113,6 +115,8 @@ if [ -e ${exclusion_file} -o -e ${inclusion_file} -o -e ${force_inclusion_file}
if [ ! -z "$opt" ] && [[ ! "$opt" =~ ^#.* ]]; then
n=${opt%=*}
v="${opt#*=}"
v="${v/#\"/}"
v="${v/%\"/}"
s=$(scripts/config --file ${CONFIG_FILE} -k --state $n)
if [ ! "$s" = "$v" ]; then
ret=2
Expand Down

0 comments on commit 5717c5d

Please sign in to comment.