Skip to content

Commit b04b922

Browse files
dc0809Dmitriy Rabotyagov
authored andcommitted
Normalize distro platform
Provide a single abstract identifier for multiple distro variants, hiding OS-specific differences. Change-Id: I19e63b792734765263cb8eae3c06b3c4e356e8a6 Co-authored-by: Dmitriy Rabotyagov <dmitriy.rabotyagov@cleura.com> Signed-off-by: Dmitriy Chubinidze <dcu995@gmail.com>
1 parent 2ed9599 commit b04b922

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

scripts/bootstrap-ansible.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ ssh_key_create
6666
determine_distro
6767

6868
# Install the python interpreters
69-
case ${DISTRO_ID} in
70-
centos|rhel|rocky)
69+
case ${DISTRO_FAMILY} in
70+
*"rhel"*)
7171
dnf -y install python3 python3-devel python3-libselinux
7272
;;
73-
ubuntu|debian)
73+
*"debian"*)
7474
apt-get update
7575
DEBIAN_FRONTEND=noninteractive apt-get -y install \
7676
python3 python3-dev \
@@ -80,15 +80,15 @@ case ${DISTRO_ID} in
8080
esac
8181

8282
# Install the base packages
83-
case ${DISTRO_ID} in
84-
rocky|centos|rhel)
83+
case ${DISTRO_FAMILY} in
84+
*"rhel"*)
8585
dnf -y install \
8686
git-core /usr/bin/curl gcc gcc-c++ nc \
8787
systemd-devel pkgconf \
8888
openssl-devel libffi-devel \
8989
rsync wget
9090
;;
91-
ubuntu|debian)
91+
*"debian"*)
9292
apt-get update
9393
DEBIAN_FRONTEND=noninteractive apt-get -y install \
9494
git-core curl gcc \

scripts/scripts-library.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ function determine_distro {
9595
export DISTRO_ID="${ID}"
9696
export DISTRO_NAME="${NAME}"
9797
export DISTRO_VERSION_ID=${VERSION_ID}
98+
export DISTRO_FAMILY="${ID_LIKE:-""} ${ID}"
9899
}
99100

100101
function ssh_key_create {
@@ -193,12 +194,12 @@ function gate_job_exit_tasks {
193194
function gate_log_requirements {
194195
# ensure packages are installed to get instance info
195196
determine_distro
196-
case ${DISTRO_ID} in
197-
ubuntu|debian)
197+
case ${DISTRO_FAMILY} in
198+
*"debian"*)
198199
apt-get update
199200
DEBIAN_FRONTEND=noninteractive apt-get -y install iproute2 net-tools parallel
200201
;;
201-
rocky|centos|rhel)
202+
*"rhel"*)
202203
dnf -y install epel-release
203204
sed -i 's/\[epel\]/&\nincludepkgs=parallel/' /etc/yum.repos.d/epel.repo
204205
dnf -y --enablerepo=epel install iproute parallel
@@ -321,12 +322,12 @@ function get_instance_info {
321322
ip link show > "/openstack/log/instance-info/links_${TS}.log" || true
322323

323324
determine_distro
324-
case ${DISTRO_ID} in
325-
rocky|rhel)
325+
case ${DISTRO_FAMILY} in
326+
*"rhel"*)
326327
rpm -qa | sort > \
327328
"/openstack/log/instance-info/host_packages_info_${TS}.log" || true
328329
;;
329-
ubuntu|debian)
330+
*"debian"*)
330331
dpkg-query --list > \
331332
"/openstack/log/instance-info/host_packages_info_${TS}.log" || true
332333
;;

0 commit comments

Comments
 (0)