Skip to content

Commit 982eddf

Browse files
zhenggen-xuyxieca
authored andcommitted
[updategraph] After system upgrade, restore files/directories with original attributes etc. (#2368)
* [updategraph] After system upgrade, restore files/directories with original attributes etc. Restore a few more files that was missed before. Restore FRR configuration directory if exists on old system Signed-off-by: Zhenggen Xu <[email protected]> * Removed deployment_id_asn_map.yml from copy list Signed-off-by: Zhenggen Xu <[email protected]>
1 parent 63863a3 commit 982eddf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

files/image_config/updategraph/updategraph

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ reload_minigraph()
1818
pfcwd start_default
1919
}
2020

21-
function copy_config_files()
21+
function copy_config_files_and_directories()
2222
{
23-
for file in $@; do
24-
if [ -f /etc/sonic/old_config/${file} ]; then
25-
logger "Copying SONiC configuration ${file} ..."
26-
cp /etc/sonic/old_config/${file} /etc/sonic/
23+
for file_dir in $@; do
24+
if [ -f /etc/sonic/old_config/${file_dir} ] || [ -d /etc/sonic/old_config/${file_dir} ]; then
25+
logger "Copying SONiC configuration ${file_dir} ..."
26+
cp -ar /etc/sonic/old_config/${file_dir} /etc/sonic/
2727
else
28-
logger "Missing SONiC configuration ${file} ..."
28+
logger "Missing SONiC configuration ${file_dir} ..."
2929
fi
3030
done
3131
}
@@ -50,9 +50,9 @@ fi
5050
. /etc/sonic/updategraph.conf
5151

5252
check_system_warm_boot
53-
53+
copy_list="minigraph.xml snmp.yml acl.json config_db.json frr"
5454
if [ -f /tmp/pending_config_migration ]; then
55-
copy_config_files minigraph.xml snmp.yml acl.json config_db.json
55+
copy_config_files_and_directories $copy_list
5656
if [ x"${WARM_BOOT}" == x"true" ]; then
5757
echo "Warm reboot detected..."
5858
elif [ "$enabled" = "true" ]; then

0 commit comments

Comments
 (0)