Skip to content

Commit

Permalink
Fix telemetry.sh passing in null as log level value (#14303)
Browse files Browse the repository at this point in the history
#### Why I did it

Bug in script that was passing in null as log level value if missing from config_db

#### How I did it

Added more robust conditional statement

#### How to verify it

1) Remove log_level from config db
2) config reload -y
3) telemetry should not crash
  • Loading branch information
zbud-msft authored Mar 20, 2023
1 parent 4429bdd commit 881b925
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dockers/docker-sonic-telemetry/telemetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if [ -z $CLIENT_AUTH ] || [ $CLIENT_AUTH == "false" ]; then
fi

LOG_LEVEL=$(echo $GNMI | jq -r '.log_level')
if [ ! -z $LOG_LEVEL ]; then
if [[ $LOG_LEVEL =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" -v=$LOG_LEVEL"
else
TELEMETRY_ARGS+=" -v=2"
Expand Down

0 comments on commit 881b925

Please sign in to comment.