devstack: Be tolerant of existing /etc/apt/sources.list.d dir

Otherwise installation fails on environments where this already exists
with:

  mkdir: cannot create directory ‘/etc/apt/sources.list.d’: File exists

NOTE:
This commit also includes 5a8e6e905d
which fixed the same problem in integration tests.

Change-Id: I10ad400879ae047c6e6248237e980174e0ccb8a9
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
(cherry picked from commit 20d7c78fb6)
This commit is contained in:
Stephen Finucane
2025-03-26 11:12:53 +00:00
committed by Takashi Kajinami
parent daa051643b
commit 74364071fe
2 changed files with 6 additions and 2 deletions

View File

@@ -170,7 +170,9 @@ function configure_mongodb {
# 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 == '24.04' ]]; then
sudo mkdir /etc/apt/sources.list.d
if [[ ! -d /etc/apt/sources.list.d ]]; then
sudo mkdir -p /etc/apt/sources.list.d
fi
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

View File

@@ -35,7 +35,9 @@ 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 == '24.04' ]]; then
sudo mkdir /etc/apt/sources.list.d
if [[ ! -d /etc/apt/sources.list.d ]]; then
sudo mkdir /etc/apt/sources.list.d
fi
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