Skip to content

Commit 379451e

Browse files
Maslov Denislguohan
Maslov Denis
authored andcommitted
[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>
1 parent ead47b6 commit 379451e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dockers/docker-orchagent/ports.json.j2

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
[
22
{% if PORT %}
3+
{% set ns = {'firstPrinted': False} %}
34
{% for port in PORT %}
45
{% if PORT[port].has_key('speed') %}
5-
{
6+
{% if ns.firstPrinted %},{% endif %}{
67
"PORT_TABLE:{{ port }}": {
78
"speed": "{{ PORT[port]['speed'] }}"
89
},
910
"OP": "SET"
10-
}{% if not loop.last %},{% endif %}
11+
}{% if ns.update({'firstPrinted': True}) %} {% endif %}
1112

1213
{% endif %}
1314
{% endfor %}

0 commit comments

Comments
 (0)