From b438cffeb50bf8e1a45640d3ecd2d7661b752839 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Thu, 3 Oct 2024 01:36:41 +0900 Subject: [PATCH] Fix mongodb installation in Ubuntu 24.04 Ubuntu 24.04 is now used in Python 3.12 tests. Change-Id: Ieefef02314b81888d49f08303926e5f6b90bd62a --- devstack/plugin.sh | 12 ++++++++++-- tools/test-setup.sh | 10 +++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index a1cf43284..f44169f71 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -183,9 +183,17 @@ function configure_mongodb { # per database. pip_install pymongo if is_ubuntu; then - # NOTE: To fix the mongodb's issue in ubuntu 22.04 LTS + # NOTE: To fix the mongodb's issue in ubuntu 22.04/24.04 LTS ubuntu_version=$(source /etc/os-release ; echo $VERSION_ID) - if [[ $ubuntu_version == '22.04' ]]; then + if [[ $ubuntu_version == '24.04' ]]; then + sudo mkdir /etc/apt/sources.list.d + wget -qO - https://www.mongodb.org/static/pgp/server-8.0.asc | sudo apt-key add - + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list + sudo apt update + install_package mongodb-org + restart_service mongod + sudo systemctl status mongod + elif [[ $ubuntu_version == '22.04' ]]; then wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list sudo apt update diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 7aa9d227e..13724379a 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -34,7 +34,15 @@ mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e " # TO fix the mongodb issue in ubuntu 22.04 ubuntu_version=$(source /etc/os-release ; echo $VERSION_ID) -if [[ $ubuntu_version == '22.04' ]]; then +if [[ $ubuntu_version == '24.04' ]]; then + sudo mkdir /etc/apt/sources.list.d + wget -qO - https://www.mongodb.org/static/pgp/server-8.0.asc | sudo apt-key add - + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list + sudo apt update + sudo apt install -y mongodb-org + sudo systemctl restart mongod + sudo systemctl status mongod +elif [[ $ubuntu_version == '22.04' ]]; then wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list sudo apt update