From 48035d75898f4e6833aabca5f1b06672a2d7d59e Mon Sep 17 00:00:00 2001 From: Vivek Reddy Date: Mon, 8 Nov 2021 09:01:46 -0800 Subject: [PATCH] [202012] [techsupport] Techsupport Error Reporting pending fixes (#1854) #### What I did This PR include some fixes which were missed while manually porting the error reporting PR onto 202012 https://github.com/Azure/sonic-utilities/pull/1833. i.e. removing -it option from the docker exec commands. to understand why the -it option was removed, refer https://github.com/Azure/sonic-utilities/pull/1723 This also include another fix which removes -d from the show ip interface command, which fails otherwise. **Note:** -d option for "show ip interface" is working on master and 202106. and not for 202012. So, this change is particular to 202012. Master: ``` admin@sonic-master-imge:~$ show ip interfaces -d all Interface Master IPv4 address/mask Admin/Oper BGP Neighbor Neighbor IP --------------- -------- ------------------- ------------ -------------- ------------- Loopback0 10.1.0.32/32 up/up N/A N/A PortChannel0001 10.0.0.56/31 up/up ARISTA01T1 10.0.0.57 PortChannel0002 10.0.0.58/31 up/up ARISTA02T1 10.0.0.59 PortChannel0003 10.0.0.60/31 up/up ARISTA03T1 10.0.0.61 PortChannel0004 10.0.0.62/31 up/up ARISTA04T1 10.0.0.63 Vlan1000 192.168.0.1/21 up/up N/A N/A docker0 240.127.1.1/24 up/down N/A N/A eth0 10.75.206.180/24 up/up N/A N/A lo 127.0.0.1/16 up/up N/A N/A ``` 202012: ``` admin@sonic-202012-image:~$ show ip interfaces -d all Usage: show ip interfaces [OPTIONS] Try "show ip interfaces -h" for help. Error: no such option: -d ``` #### How I did it #### How to verify it - Run the show tech-support and check the return status. It should be zero. (Atleast, it was on mellanox platform. I couldn't check the functions which were platform specific) - Run the "show techsupport" test. --- scripts/generate_dump | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/scripts/generate_dump b/scripts/generate_dump index c24b1c2c49..4b796c1348 100755 --- a/scripts/generate_dump +++ b/scripts/generate_dump @@ -664,11 +664,11 @@ save_redis() { save_saidump() { trap 'handle_error $? $LINENO' ERR if [[ ( "$NUM_ASICS" == 1 ) ]] ; then - save_cmd "docker exec -it syncd saidump" "saidump" + save_cmd "docker exec syncd saidump" "saidump" else for (( i=0; i<$NUM_ASICS; i++ )) do - save_cmd "docker exec -it syncd$i saidump" "saidump$i" + save_cmd "docker exec syncd$i saidump" "saidump$i" done fi } @@ -807,7 +807,7 @@ enable_logrotate() { collect_mellanox() { trap 'handle_error $? $LINENO' ERR local sai_dump_filename="/tmp/sai_sdk_dump_$(date +"%m_%d_%Y_%I_%M_%p")" - ${CMD_PREFIX}docker exec -it syncd saisdkdump -f $sai_dump_filename + ${CMD_PREFIX}docker exec syncd saisdkdump -f $sai_dump_filename ${CMD_PREFIX}docker exec syncd tar Ccf $(dirname $sai_dump_filename) - $(basename $sai_dump_filename) | tar Cxf /tmp/ - save_file $sai_dump_filename sai_sdk_dump true @@ -1161,7 +1161,7 @@ main() { save_cmd "show interface status -d all" "interface.status" save_cmd "show interface transceiver presence" "interface.xcvrs.presence" save_cmd "show interface transceiver eeprom --dom" "interface.xcvrs.eeprom" - save_cmd "show ip interface -d all" "ip.interface" + save_cmd "show ip interface" "ip.interface" save_cmd "lldpctl" "lldpctl" if [[ ( "$NUM_ASICS" > 1 ) ]]; then @@ -1266,7 +1266,11 @@ main() { fi echo ${TARFILE} - exit $RETURN_CODE + + if ! $SAVE_STDERR + then + exit $RETURN_CODE + fi } ###############################################################################