From a14cc768795360f1cd322a0d834b59ce1c71f0aa Mon Sep 17 00:00:00 2001 From: Hua Liu <58683130+liuh-80@users.noreply.github.com> Date: Thu, 20 Apr 2023 09:14:48 +0800 Subject: [PATCH] Install python-redis package to docker containers (#14632) Install python-redis package to docker containers #### Why I did it This this bug: https://github.com/sonic-net/sonic-buildimage/issues/14531 The 'flush_unused_database' is part of docker-database, and docker-database does not install python-redis package by itself. it's using redis installed by sonic-py-swsssdk. So after remove sonic-py-swsssdk from container, this script break. To this this bug and avoid similer bug happen again, install python-redis to docker containers which removed sonic-py-swsssdk . #### How I did it Install python-redis to containers. #### How to verify it Pass all UT. Create new UT to cover this scenario: https://github.com/sonic-net/sonic-mgmt/pull/8032 #### Description for the changelog Improve sudo cat command for RO user. --- dockers/docker-config-engine-bullseye/Dockerfile.j2 | 3 +++ dockers/docker-config-engine-buster/Dockerfile.j2 | 3 +++ dockers/docker-config-engine-stretch/Dockerfile.j2 | 3 +++ dockers/docker-config-engine/Dockerfile.j2 | 3 +++ 4 files changed, 12 insertions(+) diff --git a/dockers/docker-config-engine-bullseye/Dockerfile.j2 b/dockers/docker-config-engine-bullseye/Dockerfile.j2 index f7e0de09b9..84c4df100e 100644 --- a/dockers/docker-config-engine-bullseye/Dockerfile.j2 +++ b/dockers/docker-config-engine-bullseye/Dockerfile.j2 @@ -23,6 +23,9 @@ RUN apt-get install -y \ RUN pip3 install pyangbind==0.8.1 RUN pip3 uninstall -y enum34 +# Install python-redis +RUN pip3 install redis==4.5.4 + {% if docker_config_engine_bullseye_debs.strip() %} # Copy locally-built Debian package dependencies {{ copy_files("debs/", docker_config_engine_bullseye_debs.split(' '), "/debs/") }} diff --git a/dockers/docker-config-engine-buster/Dockerfile.j2 b/dockers/docker-config-engine-buster/Dockerfile.j2 index 77ea27e00e..9b8fefeed9 100644 --- a/dockers/docker-config-engine-buster/Dockerfile.j2 +++ b/dockers/docker-config-engine-buster/Dockerfile.j2 @@ -23,6 +23,9 @@ RUN apt-get install -y \ RUN pip3 install pyangbind==0.8.1 RUN pip3 uninstall -y enum34 +# Install python-redis +RUN pip3 install redis==4.5.4 + {% if docker_config_engine_buster_debs.strip() %} # Copy locally-built Debian package dependencies {{ copy_files("debs/", docker_config_engine_buster_debs.split(' '), "/debs/") }} diff --git a/dockers/docker-config-engine-stretch/Dockerfile.j2 b/dockers/docker-config-engine-stretch/Dockerfile.j2 index a0d5eaedde..c98e90ab4d 100644 --- a/dockers/docker-config-engine-stretch/Dockerfile.j2 +++ b/dockers/docker-config-engine-stretch/Dockerfile.j2 @@ -10,6 +10,9 @@ RUN apt-get update && \ build-essential \ python-dev +# Install python-redis +RUN pip install redis>=3.5.3 + {%- if CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" %} RUN apt-get install -y \ libxslt-dev \ diff --git a/dockers/docker-config-engine/Dockerfile.j2 b/dockers/docker-config-engine/Dockerfile.j2 index ccc4290b95..c470102fa4 100644 --- a/dockers/docker-config-engine/Dockerfile.j2 +++ b/dockers/docker-config-engine/Dockerfile.j2 @@ -8,6 +8,9 @@ RUN apt-get update # Dependencies for sonic-cfggen RUN apt-get install -y build-essential python-dev +# Install python-redis +RUN pip install redis>=3.5.3 + {% if docker_config_engine_debs.strip() %} COPY \ {% for deb in docker_config_engine_debs.split(' ') -%}