From ef1f976faacccc1ae234898fc9b8ba749a61ed3a Mon Sep 17 00:00:00 2001 From: Tony Breeds Date: Thu, 2 May 2024 18:18:42 -0500 Subject: [PATCH] Remove some old CentOS compatibility and address FIXMEs In earlier commits it was noted that we aren't as complete as we could be with the scripts in launch. This commit removes detection of yum as a package manager (which stopped being a real thin in CentOS-7). And creates a more complete list of tools used in the appropriate scripts Change-Id: I4cd05da18155169fd640c06a151467aed6112a3d --- launch/src/opendev_launch/mirror_volumes.sh | 12 +++--------- launch/src/opendev_launch/mount_volume.sh | 12 ++++++------ 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/launch/src/opendev_launch/mirror_volumes.sh b/launch/src/opendev_launch/mirror_volumes.sh index c23dfe2275..6142d79071 100644 --- a/launch/src/opendev_launch/mirror_volumes.sh +++ b/launch/src/opendev_launch/mirror_volumes.sh @@ -94,15 +94,9 @@ if blkid | grep -q $PV_DEVICE ; then exit 1 fi -# Because images may not have all the things we need. -# TODO(tonyb): 1) Do we really care about yum here? ; -# 2) Audit script for other tools perl/parted etc -# 3) Also other scipts in this dir -if which apt-get ; then - apt-get update && apt-get install -y lvm2 -elif which yum ; then - yum -y install lvm2 -fi +# NOTE: This isn't expected to install any packages but just in case let us +# list the script requirements here +apt-get update && apt-get install -y e2fsprogs lvm2 parted perl set -xeuo pipefail diff --git a/launch/src/opendev_launch/mount_volume.sh b/launch/src/opendev_launch/mount_volume.sh index 74db995cd2..79c6dd61d7 100644 --- a/launch/src/opendev_launch/mount_volume.sh +++ b/launch/src/opendev_launch/mount_volume.sh @@ -18,12 +18,9 @@ DEVICE=$1 MOUNT_PATH=$2 FS_LABEL=$3 -# Because images may not have all the things we need. -if which apt-get ; then - apt-get update && apt-get install -y lvm2 -elif which yum ; then - yum -y install lvm2 -fi +# NOTE: This isn't expected to install any packages but just in case let us +# list the script requirements here +apt-get update && apt-get install -y e2fsprogs lvm2 parted perl # Sanity check that we don't break anything that already has an fs. if ! blkid | grep $DEVICE ; then @@ -37,6 +34,9 @@ if ! blkid | grep $DEVICE ; then tune2fs -i 0 -c 0 /dev/main/$FS_LABEL # Remove existing fstab entries for this device. + # As this script is expected to be run on a "brand new" server this is + # reasonably safe. If /dev/main/$FS_LABEL already exists lvcreate will + # have failed and the script aborted anyway. perl -nle "m,/dev/main/$FS_LABEL, || print" -i /etc/fstab if [ ! -d $MOUNT_PATH ] ; then