Skip to content

Commit

Permalink
[iccpd][docker] fix initial startup configuration (#7982)
Browse files Browse the repository at this point in the history
#### Why I did it
The process of config generation (sonic-cfggen) fails, but the services continue to run with invalid config

#### How I did it
* add exit with error on errors in start.sh script (because supervisord relies on start.sh return code).
* fix jinja template. Jinja use common python expressions under the hood and `has_key` method was removed from dict in py3, so use check by `in` operator as it is supported by both py2 and py3.
#### How to verify it
* compile sonic with enabled iccp. 
* add mclag config to CONFIG_DB. 
    ``` 
    'MC_LAG|1' => {
        "local_ip": "10.0.0.2",
        "peer_ip": "10.0.0.3",
        "peer_link": "Ethernet8",
        "mclag_interface": "Ethernet12" 
    }
* unmaks, enable and start swss and iccpd services in sonic.
* log in into the iccpd container and check the config file `/etc/iccpd/iccpd.conf`
* expected config:
    ```
    mclag_id:1
        local_ip:10.0.0.2
        peer_ip:10.0.0.3
        peer_link:Ethernet8
        mclag_interface:Ethernet12
    system_mac:YOUR_SYSTEM_MAC

#### Description for the changelog
Fixed initial iccpd startup configuration.
  • Loading branch information
globaltrouble authored and qiluo-msft committed Aug 5, 2021
1 parent 7aad616 commit 08dc00f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dockers/docker-iccpd/iccpd.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
mclag_id:{{mclag_id}}
local_ip:{{MC_LAG[mclag_id]['local_ip']}}
peer_ip:{{MC_LAG[mclag_id]['peer_ip']}}
{% if MC_LAG[mclag_id].has_key('peer_link') %}
{% if 'peer_link' in MC_LAG[mclag_id] %}
peer_link:{{MC_LAG[mclag_id]['peer_link']}}
{% endif %}
mclag_interface:{{MC_LAG[mclag_id]['mclag_interface']}}
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-iccpd/start.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

set -e

ICCPD_CONF_PATH=/etc/iccpd

Expand Down

0 comments on commit 08dc00f

Please sign in to comment.