Install python-redis package to docker containers#14632
Install python-redis package to docker containers#14632qiluo-msft merged 3 commits intosonic-net:masterfrom
Conversation
|
Is it true that only flush_unused_database inside docker-database uses redis python package? If yes, we can change only docker-database Dockerfile. Is it possible to replace this dependency by libswsscommon? If yes, create a new issue to track. |
The swsssdk been removed from all these containser by this PR: https://github.com/sonic-net/sonic-buildimage/pull/11469/files To avoid potensial risk that other script may break because python-redis missing, maybe we install python-redis to all containers? Also it's possible replace the dependency by libswsscommon, new issue: #14634 |
dockers/docker-snmp/Dockerfile.j2
Outdated
| smbus | ||
|
|
||
| # Install python-redis | ||
| RUN pip3 install redis==4.5.4 |
There was a problem hiding this comment.
The swssdk depends on python-redis.
So before we remove swssdk by this PR, python-redis also install to docker-snmp when install swsssdk: https://github.com/sonic-net/sonic-buildimage/pull/11469/files
So to avoid potensial risk that some other script also using python-redis break because swsssdk removed from this docker, maybe we install python-redis to this container.
There was a problem hiding this comment.
Fixed, code removed.
| RUN pip3 install libpci | ||
|
|
||
| # Install python-redis | ||
| RUN pip3 install redis==4.5.4 |
There was a problem hiding this comment.
same reason as docker-snmp
There was a problem hiding this comment.
Fixed, code removed.
|
Hua, do we need to install redis to all docker config engine images, or only swss layer enough? Such as docker-swss-layer-bullseye, docker-swss-layer-buster. |
Seems those docker layer is based on docker config engine images? https://github.com/sonic-net/sonic-buildimage/blob/d57de0987a26553e94b8c31caed385e8b156c70c/dockers/docker-swss-layer-buster/Dockerfile.j2 The original swsssdk and python-redis been installed to docker config engine images, so there are potensial gap if we only install python-redis to these layer. |
@liuh-80 that is exactly my question: why do we need to have the same package in database docker when it is already installed in config engine? What is the motivation to have it in both places? |
@nazariig, I check these docker layer file, currently the python-redis does not installed in it. Also the docker-database is based on config engine, not using swss layer. |
| RUN pip3 install libpci | ||
|
|
||
| # Install python-redis | ||
| RUN pip3 install redis==4.5.4 |
There was a problem hiding this comment.
This is already in base image docker-config-engine-bullseye* #Closed
There was a problem hiding this comment.
Fixed, code removed.
dockers/docker-snmp/Dockerfile.j2
Outdated
| smbus | ||
|
|
||
| # Install python-redis | ||
| RUN pip3 install redis==4.5.4 |
There was a problem hiding this comment.
This is already in base image docker-config-engine-bullseye* #Closed
There was a problem hiding this comment.
Fixed, code removed.
| RUN pip3 uninstall -y enum34 | ||
|
|
||
| # Install python-redis | ||
| RUN pip3 install redis==4.5.4 |
There was a problem hiding this comment.
==4.5.4
@xumia, do we need to specify the version?
If python3-redis installed (redis=3.5.3 currently), then need to specify the version, or use pip3 install --upgrade redis. If the version not specified, then the installation will be skipped, use 3.5.3.
If we need the version 4.5.4 exactly, then "pip3 install redis==4.5.4" is good.
If we want to use the latest version, and at least 4.5.4, use "pip3 install redis>=4.5.4", prefer to auto version upgrade.
There was a problem hiding this comment.
Hi, we need exactly 4.5.4, because swsssdk install 4.5.4:
https://github.com/sonic-net/sonic-py-swsssdk/blob/master/setup.py
dependencies = [
'redis==4.5.4;python_version >= "3.0"',
'redis>=3.5.3;python_version < "3.0"',
'redis-dump-load',
]
Install python-redis package to docker containers #### Why I did it This this bug: sonic-net#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: sonic-net/sonic-mgmt#8032 #### Description for the changelog Improve sudo cat command for RO user.
|
Cherry-pick PR to 202211: #14775 |
Install python-redis package to docker containers #### Why I did it This this bug: #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: sonic-net/sonic-mgmt#8032 #### Description for the changelog Improve sudo cat command for RO user.
**What I did** Add new UT for flush_unused_database scripts. **Why I did it** The flush_unused_database script not cover by UT. **How I verified it** Pass all UT. **Details if related** This UT depends on PR: sonic-net/sonic-buildimage#14632
**What I did** Add new UT for flush_unused_database scripts. **Why I did it** The flush_unused_database script not cover by UT. **How I verified it** Pass all UT. **Details if related** This UT depends on PR: sonic-net/sonic-buildimage#14632
**What I did** Add new UT for flush_unused_database scripts. **Why I did it** The flush_unused_database script not cover by UT. **How I verified it** Pass all UT. **Details if related** This UT depends on PR: sonic-net/sonic-buildimage#14632
Install python-redis package to docker containers
Why I did it
This this bug: #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: sonic-net/sonic-mgmt#8032
Which release branch to backport (provide reason below if selected)
Description for the changelog
Improve sudo cat command for RO user.
Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)