[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 <zxu@linkedin.com>

* Removed deployment_id_asn_map.yml from copy list

Signed-off-by: Zhenggen Xu <zxu@linkedin.com>
This commit is contained in:
zhenggen-xu 2019-02-02 12:50:19 -08:00 committed by Ying Xie
parent 63863a361f
commit 982eddfaa4

View File

@ -18,14 +18,14 @@ reload_minigraph()
pfcwd start_default pfcwd start_default
} }
function copy_config_files() function copy_config_files_and_directories()
{ {
for file in $@; do for file_dir in $@; do
if [ -f /etc/sonic/old_config/${file} ]; then if [ -f /etc/sonic/old_config/${file_dir} ] || [ -d /etc/sonic/old_config/${file_dir} ]; then
logger "Copying SONiC configuration ${file} ..." logger "Copying SONiC configuration ${file_dir} ..."
cp /etc/sonic/old_config/${file} /etc/sonic/ cp -ar /etc/sonic/old_config/${file_dir} /etc/sonic/
else else
logger "Missing SONiC configuration ${file} ..." logger "Missing SONiC configuration ${file_dir} ..."
fi fi
done done
} }
@ -50,9 +50,9 @@ fi
. /etc/sonic/updategraph.conf . /etc/sonic/updategraph.conf
check_system_warm_boot check_system_warm_boot
copy_list="minigraph.xml snmp.yml acl.json config_db.json frr"
if [ -f /tmp/pending_config_migration ]; then if [ -f /tmp/pending_config_migration ]; then
copy_config_files minigraph.xml snmp.yml acl.json config_db.json copy_config_files_and_directories $copy_list
if [ x"${WARM_BOOT}" == x"true" ]; then if [ x"${WARM_BOOT}" == x"true" ]; then
echo "Warm reboot detected..." echo "Warm reboot detected..."
elif [ "$enabled" = "true" ]; then elif [ "$enabled" = "true" ]; then