From 6b34431779243cd274c9d4a71bb544cae980ef52 Mon Sep 17 00:00:00 2001 From: wanghao Date: Sat, 28 Jan 2023 11:10:25 +0800 Subject: [PATCH] Optimize devstack plugin For fixing the issue that mongodb in not in ubuntu 22.04 release, we need to give a work-around way to install mongodb successfully in 22.04. Change-Id: I5bb488f33d1c24298bb96e2702d2c98415db6cf4 --- devstack/plugin.sh | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index dd81b92b8..ca7575a01 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -188,14 +188,19 @@ function configure_mongodb { pip_install pymongo if is_ubuntu; then # NOTE: To fix the mongodb's issue in ubuntu 22.04 LTS - 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 - sudo apt update - curl -LO http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb - sudo dpkg -i ./libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb - - install_package mongodb-org - restart_service mongod + ubuntu_version=`cat /etc/issue | cut -d " " -f2` + if [[ $ubuntu_version > '22' ]]; 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 + sudo apt update + curl -LO http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb + sudo dpkg -i ./libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb + install_package mongodb-org + restart_service mongod + else + install_package mongodb-server + restart_service mongodb + fi elif is_fedora; then install_package mongodb install_package mongodb-server