Skip to content

Commit

Permalink
[Supervisor][fabric] Fix the error message for non-present fabric car…
Browse files Browse the repository at this point in the history
…d during config reload on SUP (#19778)

* [Supervisor][fabric] Fix the error message for non-present fabric card during config reload on SUP

Added checking to the docker_image_ctrl.j2 stop() method. This change adds code to check if related container exists, then call container stop. Otherwise, just log a message to indicate that "No such container". Fixes #19765

---------

Signed-off-by: mlok <marty.lok@nokia.com>
  • Loading branch information
mlok-nokia authored and mssonicbld committed Nov 13, 2024
1 parent 44652d4 commit 6965dc7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,20 @@ stop() {
if [[ "$DEV" && $DATABASE_TYPE != "dpudb" ]]; then
ip netns delete "$NET_NS"
fi
{%- elif docker_container_name == "teamd" %}
# Longer timeout of 60 sec to wait for Portchannels to be cleaned.
/usr/local/bin/container stop -t 60 $DOCKERNAME
{%- else %}
container_id=$(docker ps --filter "name=$DOCKERNAME" --quiet)
if [ -z "$container_id" ]; then
echo "container stop $DOCKERNAME - No such container: $DOCKERNAME"
else
{%- if docker_container_name == "teamd" %}
# Longer timeout of 60 sec to wait for Portchannels to be cleaned.
/usr/local/bin/container stop -t 60 $DOCKERNAME
{%- elif docker_container_name in ["swss", "syncd"] and enable_asan == "y" %}
/usr/local/bin/container stop -t 60 $DOCKERNAME
/usr/local/bin/container stop -t 60 $DOCKERNAME
{%- else %}
/usr/local/bin/container stop $DOCKERNAME
/usr/local/bin/container stop $DOCKERNAME
{%- endif %}
fi
{%- endif %}
}

Expand Down

0 comments on commit 6965dc7

Please sign in to comment.