@@ -867,6 +867,7 @@ save_platform_info() {
867
867
# filename: the full path of the file to save
868
868
# base_dir: the directory in $TARDIR/ to stage the file
869
869
# do_gzip: (OPTIONAL) true or false. Should the output be gzipped
870
+ # do_tar_append: (OPTIONAL) true or false. Should the output be added to final tar archive
870
871
# Returns:
871
872
# None
872
873
# ##############################################################################
@@ -877,13 +878,16 @@ save_file() {
877
878
local orig_path=$1
878
879
local supp_dir=$2
879
880
local gz_path=" $TARDIR /$supp_dir /$( basename $orig_path ) "
881
+ local tar_path=" ${BASE} /$supp_dir /$( basename $orig_path ) "
880
882
local do_gzip=${3:- true}
883
+ local do_tar_append=${4:- false}
881
884
if [ ! -d " $TARDIR /$supp_dir " ]; then
882
885
$MKDIR $V -p " $TARDIR /$supp_dir "
883
886
fi
884
887
885
888
if $do_gzip ; then
886
889
gz_path=" ${gz_path} .gz"
890
+ tar_path=" ${tar_path} .gz"
887
891
if $NOOP ; then
888
892
echo " gzip -c $orig_path > $gz_path "
889
893
else
@@ -897,6 +901,12 @@ save_file() {
897
901
fi
898
902
fi
899
903
904
+ if $do_tar_append ; then
905
+ ($TAR $V -rhf $TARFILE -C $DUMPDIR " $tar_path " \
906
+ || abort " ${EXT_PROCFS_SAVE_FAILED} " " tar append operation failed. Aborting to prevent data loss." ) \
907
+ && $RM $V -f " $gz_path "
908
+ fi
909
+
900
910
end_t=$( date +%s%3N)
901
911
echo " [ save_file:$orig_path ] : $(( $end_t - $start_t )) msec" >> $TECHSUPPORT_TIME_INFO
902
912
}
@@ -1086,9 +1096,9 @@ collect_mellanox_dfw_dumps() {
1086
1096
${CMD_PREFIX} save_symlink ${file} sai_sdk_dump log
1087
1097
else
1088
1098
if [ ! -z " ${file##* .gz} " ]; then
1089
- ${CMD_PREFIX} save_file ${file} sai_sdk_dump true
1099
+ ${CMD_PREFIX} save_file ${file} sai_sdk_dump true true
1090
1100
else
1091
- ${CMD_PREFIX} save_file ${file} sai_sdk_dump false
1101
+ ${CMD_PREFIX} save_file ${file} sai_sdk_dump false true
1092
1102
fi
1093
1103
fi
1094
1104
done
@@ -1377,9 +1387,9 @@ save_sai_failure_dump(){
1377
1387
${CMD_PREFIX} save_symlink ${file} sai_failure_dump log
1378
1388
else
1379
1389
if [ ! -z " ${file##* .gz} " ]; then
1380
- ${CMD_PREFIX} save_file ${file} sai_failure_dump true
1390
+ ${CMD_PREFIX} save_file ${file} sai_failure_dump true true
1381
1391
else
1382
- ${CMD_PREFIX} save_file ${file} sai_failure_dump false
1392
+ ${CMD_PREFIX} save_file ${file} sai_failure_dump false true
1383
1393
fi
1384
1394
fi
1385
1395
# Clean up the file once its part of tech support
@@ -1643,7 +1653,7 @@ main() {
1643
1653
$RM $V -rf $TARDIR /etc/alternatives $TARDIR /etc/passwd* \
1644
1654
$TARDIR /etc/shadow* $TARDIR /etc/group* $TARDIR /etc/gshadow* \
1645
1655
$TARDIR /etc/ssh* $TARDIR /etc/mlnx $TARDIR /etc/mft \
1646
- $TARDIR /etc/ssl/certs/ $TARDIR /etc/ssl/private/*
1656
+ $TARDIR /etc/ssl/certs/* $TARDIR /etc/ssl/private/*
1647
1657
rm_list=$( find -L $TARDIR -type f \( -iname \* .cer -o -iname \* .crt -o \
1648
1658
-iname \* .pem -o -iname \* .key -o -iname \* snmpd.conf\* -o -iname \* get_creds\* \) )
1649
1659
if [ ! -z " $rm_list " ]
@@ -1656,6 +1666,8 @@ main() {
1656
1666
save_warmboot_files &
1657
1667
wait
1658
1668
1669
+ save_to_tar
1670
+
1659
1671
save_sai_failure_dump
1660
1672
1661
1673
if [[ " $asic " = " mellanox" ]]; then
@@ -1670,9 +1682,7 @@ main() {
1670
1682
# ##############################################################################
1671
1683
finalize () {
1672
1684
# Save techsupport timing profile info
1673
- save_file $TECHSUPPORT_TIME_INFO log false
1674
-
1675
- save_to_tar
1685
+ save_file $TECHSUPPORT_TIME_INFO log false true
1676
1686
1677
1687
if $DO_COMPRESS ; then
1678
1688
RC=0
0 commit comments