[ntp]: modified ntp script to hide the error related to cfggen (#3745)

This PR is to handle the issue 3527.
When device boots up, NTP throws a traceback as explained in the issue 3527.

- Traceback will be seen when MGMT_VRF_CONFIG does not exist in the database. Traceback is coming from the script “/etc/init.d/ntp”.

- Traceback does not affect the NTP functionality with/without management VRF. When MGMT_VRF_CONFIG does not exist or when MGMT_VRF_CONFIG’s mgmtVrfEnabled is configured to “false”, “NTP” will be started in the “default VRF” context, which is working fine even with this traceback.

- This traceback error will be hidden by redirecting the error to /dev/null without affecting functionality.
This commit is contained in:
kannankvs 2019-11-14 13:36:54 +05:30 committed by lguohan
parent 4f35a81065
commit 4007d9ba9c

View File

@ -50,7 +50,7 @@ case $1 in
fi
(
flock -w 180 9
vrfEnabled=$(/usr/local/bin/sonic-cfggen -d -v 'MGMT_VRF_CONFIG["vrf_global"]["mgmtVrfEnabled"]')
vrfEnabled=$(/usr/local/bin/sonic-cfggen -d -v 'MGMT_VRF_CONFIG["vrf_global"]["mgmtVrfEnabled"]' 2> /dev/null)
if [ "$vrfEnabled" = "true" ]
then
log_daemon_msg "Starting NTP server in mgmt-vrf" "ntpd"