From 54aed6be0f2b5a53042185b481587e445e923c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Andr=C3=A9?= Date: Tue, 7 Mar 2023 19:22:10 +0100 Subject: [PATCH] Fix install of mongodb on Ubuntu 22.04 Simplify the version check to make it less error prone, use the right version of the 22.04 repository from mongodb.org (jammy vs focal) and stop trying to install libssl package that no longer exists on the repository. Change-Id: I49d32e555e6a0df15c0e059e8c4152a969ab3975 --- devstack/plugin.sh | 6 +++--- tools/test-setup.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 1a3189e97..28d799467 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -176,10 +176,10 @@ function configure_mongodb { pip_install pymongo if is_ubuntu; then # NOTE: To fix the mongodb's issue in ubuntu 22.04 LTS - ubuntu_version=`cat /etc/issue | cut -d " " -f2` - if [[ $ubuntu_version > '22' ]]; then + ubuntu_version=$(source /etc/os-release ; echo $VERSION_ID) + if [[ $ubuntu_version == '22.04' ]]; then wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list sudo apt update curl -LO http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb sudo dpkg -i ./libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 7bfbdecb6..0dd81dbd4 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -33,10 +33,10 @@ mysql -u $DB_USER -p$DB_PW -h 127.0.0.1 -e " CREATE DATABASE openstack_citest CHARACTER SET utf8;" # TO fix the mongodb issue in ubuntu 22.04 -ubuntu_version=`cat /etc/issue | cut -d " " -f2` -if [[ $ubuntu_version > '22' ]]; then +ubuntu_version=$(source /etc/os-release ; echo $VERSION_ID) +if [[ $ubuntu_version == '22.04' ]]; then wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list + echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list sudo apt update curl -LO http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb sudo dpkg -i ./libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb