From 3c1627dbca84c97e4ef2422e86d46d41e839713e Mon Sep 17 00:00:00 2001 From: hwang Date: Wed, 30 Aug 2023 14:21:10 -0700 Subject: [PATCH] Fix devstack plugin to support centos/rhel 9 Since there is no official repo of MongoDB for Centos-Stream-9 or Rhel-9, we will build the repo by script. Change-Id: I1f20eb22d6e922d12e0d88aae5bf47c032db3cb3 --- bindep.txt | 2 +- devstack/plugin.sh | 24 +++++++++++++++++++----- tools/test-setup.sh | 4 ++-- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/bindep.txt b/bindep.txt index 0603c33ed..19ab91d09 100644 --- a/bindep.txt +++ b/bindep.txt @@ -8,7 +8,7 @@ dev-db/mongodb [platform:gentoo] redis [platform:rpm] redis-server [platform:dpkg] dev-db/redis [platform:gentoo] -libmysqlclient-dev [platform:dpkg] +default-libmysqlclient-dev [platform:dpkg] libmysqlclient-devel [platform:suse] mysql-client [platform:dpkg] mysql-server [platform:dpkg] diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 585fe63ca..24b8d3715 100755 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -190,8 +190,8 @@ function configure_mongodb { # NOTE: To fix the mongodb's issue in ubuntu 22.04 LTS 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 jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list + 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 echo "deb http://security.ubuntu.com/ubuntu bionic-security main" | sudo tee /etc/apt/sources.list.d/bionic-security.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 sudo apt update @@ -204,9 +204,23 @@ function configure_mongodb { restart_service mongodb fi elif is_fedora; then - install_package mongodb - install_package mongodb-server - restart_service mongod + fedora_version=$(source /etc/os-release ; echo $VERSION_ID) + if [[ $fedora_version == '9' ]]; then + cat > /etc/yum.repos.d/mongodb-org-6.0.repo << __EOF__ +[mongodb-org-6.0] +name=MongoDB Repository +baseurl=https://repo.mongodb.org/yum/redhat/8/mongodb-org/6.0/x86_64/ +gpgcheck=1 +enabled=1 +gpgkey=https://www.mongodb.org/static/pgp/server-6.0.asc +__EOF__ + install_package mongodb-org + restart_service mongod + else + install_package mongodb + install_package mongodb-server + restart_service mongod + fi fi } diff --git a/tools/test-setup.sh b/tools/test-setup.sh index 3b883f48a..1144c9af2 100755 --- a/tools/test-setup.sh +++ b/tools/test-setup.sh @@ -35,8 +35,8 @@ 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 - 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 jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list + 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 echo "deb http://security.ubuntu.com/ubuntu bionic-security main" | sudo tee /etc/apt/sources.list.d/bionic-security.list sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32 sudo apt update