[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 <Denis.Maslov@cavium.com>
This commit is contained in:
Maslov Denis 2017-12-12 13:58:39 +02:00 committed by lguohan
parent ead47b66a0
commit 379451ef2b

View File

@ -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 %}