[docker_image_ctl.j2] skip hostname update if is up to date (#3529)

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
This commit is contained in:
Stepan Blyshchak 2019-10-02 06:48:03 +03:00 committed by Joe LeVeque
parent abc02a702e
commit 52e35a0f95

View File

@ -119,7 +119,7 @@ function postStartAction()
v3SnmpTrapIp=`/usr/bin/redis-cli -n 4 hget "SNMP_TRAP_CONFIG|v3TrapDest" DestIp`
v3SnmpTrapPort=`/usr/bin/redis-cli -n 4 hget "SNMP_TRAP_CONFIG|v3TrapDest" DestPort`
v3MgmtVrf=`/usr/bin/redis-cli -n 4 hget "SNMP_TRAP_CONFIG|v3TrapDest" vrf`
if [ "${v1SnmpTrapIp}" != "" ]
then
sed -i "s/v1_trap_dest:.*/v1_trap_dest: ${v1SnmpTrapIp}:${v1SnmpTrapPort}%${v1MgmtVrf}/" "/etc/sonic/snmp.yml"
@ -185,7 +185,10 @@ start() {
{%- endif %}
preStartAction
docker start {{docker_container_name}}
updateHostName "$HOSTNAME"
CURRENT_HOSTNAME="$(docker exec {{docker_container_name}} hostname)"
if [ x"$HOSTNAME" != x"$CURRENT_HOSTNAME" ]; then
updateHostName "$HOSTNAME"
fi
postStartAction
exit $?
fi