Skip to content

Commit

Permalink
[docker-orchagent]: ports.json.j2 template fixed (#1177)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
Maslov Denis authored and lguohan committed Dec 12, 2017
1 parent ead47b6 commit 379451e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dockers/docker-orchagent/ports.json.j2
Original file line number Diff line number Diff line change
@@ -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 %}
Expand Down

0 comments on commit 379451e

Please sign in to comment.