Support CentOS 8 builds 31/63531/3 v0.5.0
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Fri, 27 Mar 2020 22:14:36 +0000 (15:14 -0700)
committerAndrew Grimberg <agrimberg@linuxfoundation.org>
Thu, 2 Apr 2020 13:32:29 +0000 (06:32 -0700)
Changes needed to run the packer against CentOS 8 systems

Issue: RELENG-2823
Change-Id: I7748d98150630bc5327d407eab5421a2ec21e7bf
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
provision/install-base-pkgs-RedHat.yaml
provision/install-python.sh

index 7e3dd34..898b4e6 100644 (file)
       - git2u*
       - yum-plugin-replace
   become: true
+  when:
+    - ansible_distribution_major_version < 8
+
+- name: Enable PowerTools
+  command:
+    cmd: dnf config-manager --set-enabled PowerTools
+    warn: no
+  become: true
+  when: ansible_distribution_major_version >= 8
 
 - name: Install base packages
   yum:
@@ -19,7 +28,7 @@
       - "@base"
       - "@development"
       - yum-utils
-      - https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
+      - https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm
     state: latest
   become: true
 
@@ -37,3 +46,5 @@
       command: yum replace -y git --replace-with git2u
       when: ansible_facts.packages['git'] is defined
   become: true
+  when:
+    - ansible_distribution_major_version < 8
index 44056c3..7ede4ec 100755 (executable)
@@ -28,6 +28,17 @@ function is_ubuntu()
     return 1
 }
 
+function is_centos8()
+{
+    # if the file exists and contains a centos:8 CPE_NAME, return 0
+    if grep -Eq "^CPE_NAME=.*centos:8" /etc/os-release 2> /dev/null; then
+        echo "Distro is CentOS 8"
+        return 0
+    fi
+    echo "Distro is NOT CentOS 8"
+    return 1
+}
+
 if is_ubuntu; then
     # Use netselect to choose a package mirror to install python-minimal in a
     # reliable manner.
@@ -67,5 +78,11 @@ if is_ubuntu; then
     apt install -y python-minimal
 fi
 
-type python
+if is_centos8; then
+    echo "Install python36"
+    dnf clean all
+    dnf install -y python36
+fi
+
+type python || type python3
 type sudo