Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[202012] Revert #1945 commit #1993

Merged
merged 1 commit into from
Dec 30, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 5 additions & 19 deletions scripts/generate_dump
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ DUMPDIR=/var/dump
TARDIR=$DUMPDIR/$BASE
TARFILE=$DUMPDIR/$BASE.tar
LOGDIR=$DUMPDIR/$BASE/dump
PLUGINS_DIR=/usr/local/bin/debug-dump
NUM_ASICS=1
HOME=${HOME:-/root}
USER=${USER:-root}
Expand Down Expand Up @@ -154,7 +153,6 @@ save_bcmcmd_all_ns() {
# filename: the filename to save the output as in $BASE/dump
# do_gzip: (OPTIONAL) true or false. Should the output be gzipped
# cleanup_method: (OPTIONAL) the cleanup method to procress dump file after it generated.
# save_stderr: (OPTIONAL) true or false. Should the stderr output be saved
# Returns:
# None
###############################################################################
Expand All @@ -166,7 +164,6 @@ save_cmd() {
local filename=$2
local filepath="${LOGDIR}/$filename"
local do_gzip=${3:-false}
local save_stderr=${4:-true}
local tarpath="${BASE}/dump/$filename"
local timeout_cmd="timeout --foreground ${TIMEOUT_MIN}m"
local cleanup_method=${4:-dummy_cleanup_method}
Expand All @@ -186,11 +183,6 @@ save_cmd() {
$MKDIR $V -p $LOGDIR
fi

if ! $save_stderr
then
redirect=">"
fi

# eval required here to re-evaluate the $cmd properly at runtime
# This is required if $cmd has quoted strings that should be bunched
# as one argument, e.g. vtysh -c "COMMAND HERE" needs to have
Expand Down Expand Up @@ -847,7 +839,7 @@ collect_mellanox() {
${CMD_PREFIX}/usr/bin/mstdump /dev/mst/mt*conf0 > "${mst_dump_filename}${i}"
save_file "${mst_dump_filename}${i}" mstdump true
done

# Save SDK error dumps
local sdk_dump_path=`${CMD_PREFIX}docker exec syncd cat /tmp/sai.profile|grep "SAI_DUMP_STORE_PATH"|cut -d = -f2`
if [[ -d $sdk_dump_path ]]; then
Expand Down Expand Up @@ -1064,7 +1056,7 @@ save_crash_files() {
get_asic_count() {
trap 'handle_error $? $LINENO' ERR
local redirect_eval="2>&1"
if ! $SAVE_STDERR
if ! $SAVE_STDERR
then
redirect_eval=""
fi
Expand Down Expand Up @@ -1224,12 +1216,6 @@ main() {
save_cmd "docker ps -a" "docker.ps"
save_cmd "docker top pmon" "docker.pmon"

local -r dump_plugins="$(find ${PLUGINS_DIR} -type f -executable)"
for plugin in $dump_plugins; do
# save stdout output of plugin and gzip it
save_cmd "$plugin" "$(basename $plugin)" true false
done

save_saidump

if [[ "$asic" = "mellanox" ]]; then
Expand Down Expand Up @@ -1312,7 +1298,7 @@ main() {
fi

echo ${TARFILE}

if ! $SAVE_STDERR
then
exit $RETURN_CODE
Expand Down Expand Up @@ -1364,7 +1350,7 @@ remove_secret_from_etc_files() {

# Remove snmp community string from snmp.yml
sed -i -E 's/(\s*snmp_\S*community\s*:\s*)(\S*)/\1****/g' $dumppath/etc/sonic/snmp.yml

# Remove secret from /etc/sonic/config_db.json
cat $dumppath/etc/sonic/config_db.json | remove_secret_from_config_db_dump > $dumppath/etc/sonic/config_db.json.temp
mv $dumppath/etc/sonic/config_db.json.temp $dumppath/etc/sonic/config_db.json
Expand Down Expand Up @@ -1423,7 +1409,7 @@ OPTIONS
"24 March", "yesterday", etc.
-t TIMEOUT_MINS
Command level timeout in minutes
-r
-r
Redirect any intermediate errors to STDERR

EOF
Expand Down