Skip to content

Commit ab2d066

Browse files
marian-pritsaklguohan
authored andcommitted
[snmp]: Save S/N in state DB prior to starting service (#1246)
snmp.service needs to read chassis serial number for one of its mibs. We save this value in state DB so that it is accessible from container. Signed-off-by: marian-pritsak <[email protected]>
1 parent 6e05b67 commit ab2d066

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

files/build_templates/docker_image_ctl.j2

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ function postStartAction()
1717
sleep 1
1818
done
1919
{%- endif %}
20+
{%- if docker_container_name == "snmp" %}
21+
docker exec -i database redis-cli -n 6 HSET 'DEVICE_METADATA|localhost' chassis_serial_number $(decode-syseeprom -s)
22+
{%- endif %}
2023
}
2124

2225
# Obtain our platform as we will mount directories with these names in each docker

files/build_templates/snmp.service.j2

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Requires=database.service swss.service
44
After=database.service swss.service
55

66
[Service]
7-
User={{ sonicadmin_user }}
87
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
98
ExecStart=/usr/bin/{{docker_container_name}}.sh attach
109
ExecStop=/usr/bin/{{docker_container_name}}.sh stop

0 commit comments

Comments
 (0)