ossobv / sonic-buildimage

Scripts which perform an installable binary image build for SONiC
Other
0 stars 0 forks source link

runtime: "Syntax of the line program:redisprogram:redis_bmp#012 in processes file is incorrect" #17

Open wdoekes opened 2 weeks ago

wdoekes commented 2 weeks ago

UPDATE

Parts are fixed in master. But it's not backported to 202405, and it might bite again later.

Good fixes:

diff --git a/dockers/docker-database/critical_processes.j2 b/dockers/docker-database/critical_processes.j2
index 1f524132e..5bf4dbce4 100644
--- a/dockers/docker-database/critical_processes.j2
+++ b/dockers/docker-database/critical_processes.j2
@@ -1,5 +1,5 @@
-{% if INSTANCES %}
-{%     for redis_inst, redis_items in INSTANCES.items() %}
+{% if INSTANCES -%}
+{%     for redis_inst, redis_items in INSTANCES.items() -%}
 program:{{ redis_inst }}
-{%-     endfor %}
-{%- endif %}
+{%     endfor -%}
+{% endif -%}
diff --git a/dockers/docker-fpm-frr/frr/supervisord/critical_processes.j2 b/dockers/docker-fpm-frr/frr/supervisord/critical_processes.j2
index 69f4e8e69..4d65186b6 100644
--- a/dockers/docker-fpm-frr/frr/supervisord/critical_processes.j2
+++ b/dockers/docker-fpm-frr/frr/supervisord/critical_processes.j2
@@ -2,11 +2,11 @@ program:zebra
 program:staticd
 program:bgpd
 program:fpmsyncd
-{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" %}
+{% if DEVICE_METADATA.localhost.frr_mgmt_framework_config is defined and DEVICE_METADATA.localhost.frr_mgmt_framework_config == "true" -%}
 program:bfdd
 program:ospfd
 program:pimd
 program:frrcfgd
-{%- else %}
+{% else -%}
 program:bgpcfgd
-{%- endif %}
+{% endif -%}
diff --git a/dockers/docker-orchagent/critical_processes.j2 b/dockers/docker-orchagent/critical_processes.j2
index b9bad7408..4b7f8accd 100644
--- a/dockers/docker-orchagent/critical_processes.j2
+++ b/dockers/docker-orchagent/critical_processes.j2
@@ -1,11 +1,11 @@
-{% set is_fabric_asic = 0 %}
-{% if DEVICE_METADATA.localhost.switch_type %}
-{% if DEVICE_METADATA.localhost.switch_type == "fabric" %}
-{% set is_fabric_asic = 1 %}
-{% endif %}
-{% endif %}
+{% set is_fabric_asic = 0 -%}
+{% if DEVICE_METADATA.localhost.switch_type -%}
+{% if DEVICE_METADATA.localhost.switch_type == "fabric" -%}
+{% set is_fabric_asic = 1 -%}
+{% endif -%}
+{% endif -%}
 program:orchagent
-{% if is_fabric_asic == 0 %}
+{% if is_fabric_asic == 0 -%}
 program:portsyncd
 program:neighsyncd
 program:fdbsyncd
@@ -19,4 +19,4 @@ program:nbrmgrd
 program:vxlanmgrd
 program:coppmgrd
 program:tunnelmgrd
-{%- endif %}
+{% endif %}

ORIGINAL

See #-20636.

Unsure if this is relevant. Looks new if this was not in the september-master-issue.

Looks like this:

[program:redis]
command=/bin/bash -c "{ [[ -s /var/lib/redis/dump.rdb ]] || rm -f /var/lib/redis/dump.rdb; } && mkdir -p /var/lib/redis && exec /usr/bin/redis-server /etc/redis/redis.conf --bind  127.0.0.1 --port 6379 --unixsocket /var/run/redis/redis.sock --pidfile /var/run/redis/redis.pid --dir /var/lib/redis "
priority=2
user=redis
autostart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:redis_bmp]
command=/bin/bash -c "{ [[ -s /var/lib/redis_bmp/dump.rdb ]] || rm -f /var/lib/redis_bmp/dump.rdb; } && mkdir -p /var/lib/redis_bmp && exec /usr/bin/redis-server /etc/redis/redis.conf --bind  127.0.0.1 --port 6400 --unixsocket /var/run/redis/redis_bmp.sock --pidfile /var/run/redis/redis_bmp.pid --dir /var/lib/redis_bmp "
priority=2
user=redis
autostart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog

^- this is likely since 06c469e6cc0a13beae45f2bdbea8c0d0ee82946c

Cause, probably this:

root@spine1:/# cat /etc/supervisor/critical_processes 
program:redis

root@leaf1:/# cat /etc/supervisor/critical_processes
program:redisprogram:redis_bmp

./dockers/docker-database/critical_processes.j2

{% if INSTANCES %}
{%     for redis_inst, redis_items in INSTANCES.items() %}
program:{{ redis_inst }}
{%-     endfor %}
{%- endif %}

Excess jinja line removal.

wdoekes commented 9 hours ago

We'll do:

github.com/sonic-net/sonic-buildimage/pull 20897

And leave the rest.

The jinja stuff in sonig-cfggen is different and strip()s output mostly, so these fixes don't add any better output.