Skip to content

Commit

Permalink
[telemetry.sh] Fix string null check with special characters by addin…
Browse files Browse the repository at this point in the history
…g quotes (sonic-net#3810)

* adding quotes for string comparison with special characters

* Update dockers/docker-sonic-telemetry/telemetry.sh

Co-Authored-By: Joe LeVeque <jleveque@users.noreply.github.com>

* Update dockers/docker-sonic-telemetry/telemetry.sh

Co-Authored-By: Joe LeVeque <jleveque@users.noreply.github.com>
  • Loading branch information
2 people authored and zhenggen-xu committed Jan 9, 2020
1 parent c0e7d59 commit 71615fd
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dockers/docker-sonic-telemetry/telemetry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ TELEMETRY=`sonic-cfggen -d -v 'TELEMETRY.keys() | join(" ") if TELEMETRY'`

TELEMETRY_ARGS=" -logtostderr"

if [ ! -z $X509 ]; then
if [ -n "$X509" ]; then
SERVER_CRT=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_crt']"`
SERVER_KEY=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['server_key']"`
if [ -z $SERVER_CRT ] || [ -z $SERVER_KEY ]; then
Expand All @@ -19,7 +19,7 @@ else
TELEMETRY_ARGS+=" --insecure"
fi

if [ ! -z $X509 ]; then
if [ -n "$X509" ]; then
CA_CRT=`sonic-cfggen -d -v "DEVICE_METADATA['x509']['ca_crt']"`
if [ ! -z $CA_CRT ]; then
TELEMETRY_ARGS+=" --ca_crt $CA_CRT"
Expand Down Expand Up @@ -47,5 +47,3 @@ else
fi

exec /usr/sbin/telemetry ${TELEMETRY_ARGS}


0 comments on commit 71615fd

Please sign in to comment.