[telemetry.sh] Fix string null check with special characters by adding quotes (#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>
This commit is contained in:
pra-moh 2019-11-23 12:30:56 -08:00 committed by lguohan
parent 8d4516ca3d
commit 65f7da87a7

View File

@ -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
@ -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"
@ -47,5 +47,3 @@ else
fi
exec /usr/sbin/telemetry ${TELEMETRY_ARGS}