From 379451ef2bc90a8e43af80e08d852af2a092f86d Mon Sep 17 00:00:00 2001 From: Maslov Denis Date: Tue, 12 Dec 2017 13:58:39 +0200 Subject: [PATCH] [docker-orchagent]: ports.json.j2 template fixed (#1177) * Template generates a correct output now, without excess comma in case the last port in list has no port speed setting in the redis-db Signed-off-by: Denis Maslov --- dockers/docker-orchagent/ports.json.j2 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dockers/docker-orchagent/ports.json.j2 b/dockers/docker-orchagent/ports.json.j2 index 48be831025..3b32250915 100644 --- a/dockers/docker-orchagent/ports.json.j2 +++ b/dockers/docker-orchagent/ports.json.j2 @@ -1,13 +1,14 @@ [ {% if PORT %} +{% set ns = {'firstPrinted': False} %} {% for port in PORT %} {% if PORT[port].has_key('speed') %} - { + {% if ns.firstPrinted %},{% endif %}{ "PORT_TABLE:{{ port }}": { "speed": "{{ PORT[port]['speed'] }}" }, "OP": "SET" - }{% if not loop.last %},{% endif %} + }{% if ns.update({'firstPrinted': True}) %} {% endif %} {% endif %} {% endfor %}