diff --git a/common-tasks/test-set-nodepool-vars.yml b/common-tasks/test-set-nodepool-vars.yml index f15a185c..87237008 100644 --- a/common-tasks/test-set-nodepool-vars.yml +++ b/common-tasks/test-set-nodepool-vars.yml @@ -39,12 +39,12 @@ # checking for local packages. The RDO repository package isn't signed, but the # repos it installs have GPG checking enabled. - name: Install the RDO release package - yum: + package: name: "https://repos.fedorapeople.org/repos/openstack/openstack-ocata/rdo-release-ocata.rpm" state: "present" disable_gpg_check: yes when: - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] - name: Set the files to copy into the container cache for OpenStack-CI instances set_fact: diff --git a/run_tests.sh b/run_tests.sh index 969e3db0..e8f6f3ac 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -35,9 +35,12 @@ source /etc/os-release || source /usr/lib/os-release install_pkg_deps() { pkg_deps="git" + # Prefer dnf over yum for CentOS. + which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum' + case ${ID,,} in *suse*) pkg_mgr_cmd="zypper -n in" ;; - centos|rhel) pkg_mgr_cmd="yum install -y" ;; + centos|rhel) pkg_mgr_cmd="${RHT_PKG_MGR} install -y" ;; fedora) pkg_mgr_cmd="dnf -y install" ;; ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;; *) echo "unsupported distribution: ${ID,,}"; exit 1 ;; diff --git a/run_tests_common.sh b/run_tests_common.sh index d7d07c56..23df6c29 100755 --- a/run_tests_common.sh +++ b/run_tests_common.sh @@ -20,6 +20,9 @@ BINDEP_FILE=${BINDEP_FILE:-bindep.txt} source /etc/os-release || source /usr/lib/os-release +# Prefer dnf over yum for CentOS. +which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum' + case "${ID,,}" in *suse*) # Need to pull libffi and python-pyOpenSSL early @@ -28,7 +31,7 @@ case "${ID,,}" in sudo zypper -n in python-devel lsb-release ${extra_suse_deps:-} ;; amzn|centos|rhel) - sudo yum install -y python-devel redhat-lsb-core + sudo $RHT_PKG_MGR install -y python-devel redhat-lsb-core ;; ubuntu|debian) sudo apt-get update && sudo apt-get install -y python-dev lsb-release @@ -51,7 +54,7 @@ sudo pip install 'bindep>=2.4.0' tox # redhat-lsb-core - for bindep profile support # epel-release - required to install python-ndg_httpsclient/python2-pyasn1 if [[ ${ID,,} == "centos" ]]; then - sudo yum -y install redhat-lsb-core epel-release yum-utils + sudo $RHT_PKG_MGR -y install redhat-lsb-core epel-release yum-utils # epel-release could be installed but not enabled (which is very common # in openstack-ci) so enable it here if needed sudo yum-config-manager --enable epel || true @@ -72,7 +75,7 @@ if [[ ${#BINDEP_PKGS} > 0 ]]; then sudo zypper -n in $BINDEP_PKGS ;; centos) - sudo yum install -y $BINDEP_PKGS + sudo $RHT_PKG_MGR install -y $BINDEP_PKGS ;; ubuntu|debian) sudo apt-get update diff --git a/test-ansible-functional.sh b/test-ansible-functional.sh index 2142a8e8..d69e0140 100755 --- a/test-ansible-functional.sh +++ b/test-ansible-functional.sh @@ -105,7 +105,7 @@ function gate_job_exit_tasks { # NOTE(mhayden): CentOS images in the gate have several slow mirrors enabled # by default. This step ensures that only the base, epel, and updates # repositories are enabled. -if which yum &>/dev/null; then +if which yum &>/dev/null || which dnf &>/dev/null; then sudo yum-config-manager --disable \* sudo yum-config-manager --enable base sudo yum-config-manager --enable epel diff --git a/test-install-neutron.yml b/test-install-neutron.yml index 84d86a04..010f0209 100644 --- a/test-install-neutron.yml +++ b/test-install-neutron.yml @@ -24,6 +24,7 @@ vars: kernel_module_path: apt: "lib/modules" + dnf: "usr/lib/modules" yum: "usr/lib/modules" zypper: "lib/modules" vars_files: @@ -60,6 +61,8 @@ required_packages: apt: - "libffi-dev" + dnf: + - "libffi-devel" yum: - "libffi-devel" zypper: diff --git a/test-install-nova.yml b/test-install-nova.yml index 45adc2db..c593ddcf 100644 --- a/test-install-nova.yml +++ b/test-install-nova.yml @@ -29,6 +29,12 @@ - libffi-dev - pkg-config - libvirt-dev + dnf: + - libxml2-devel + - libxslt-devel + - libffi-devel + - pkgconfig + - libvirt-devel yum: - libxml2-devel - libxslt-devel diff --git a/test-log-collect.sh b/test-log-collect.sh index 947e3444..799854ea 100755 --- a/test-log-collect.sh +++ b/test-log-collect.sh @@ -62,9 +62,11 @@ if [[ -d "/etc/nodepool" ]]; then # output ram usage free -m > "${WORKING_DIR}/logs/memory-available.txt" || true # Redhat package debugging - if which yum &>/dev/null; then - sudo yum repolist -v > "${WORKING_DIR}/logs/redhat-yum-repolist.txt" || true - sudo yum list installed > "${WORKING_DIR}/logs/redhat-yum-list-installed.txt" || true + if which yum &>/dev/null || which dnf &>/dev/null; then + # Prefer dnf over yum for CentOS. + which dnf &>/dev/null && RHT_PKG_MGR='dnf' || RHT_PKG_MGR='yum' + sudo $RHT_PKG_MGR repolist -v > "${WORKING_DIR}/logs/redhat-rpm-repolist.txt" || true + sudo $RHT_PKG_MGR list installed > "${WORKING_DIR}/logs/redhat-rpm-list-installed.txt" || true # SUSE package debugging elif which zypper &>/dev/null; then sudo zypper lr -d > "${WORKING_DIR}/logs/suse-zypper-repolist.txt" || true diff --git a/test-prepare-host.yml b/test-prepare-host.yml index ee54b503..83ad332e 100644 --- a/test-prepare-host.yml +++ b/test-prepare-host.yml @@ -76,7 +76,7 @@ with_items: "{{ bridges }}" register: network_interfaces_rhel when: - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] - name: Copy network configuration (SUSE) template: @@ -93,7 +93,7 @@ dest: "/etc/sysconfig/network-scripts/ifcfg-{{ item.name | default('br-mgmt')}}:0" with_items: "{{ bridges }}" when: - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] - item.alias is defined - name: Put down post-up script for veth-peer interfaces (RedHat) @@ -106,7 +106,7 @@ - "{{ bridges }}" when: - item[1].veth_peer is defined - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] # NOTE(hworang): Nested loops do not work on blocks. See # https://github.com/ansible/ansible/issues/13262 @@ -157,7 +157,7 @@ - "{{ bridges }}" when: - item[1].veth_peer is defined - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] - name: Shut down the network interfaces command: "ifdown {{ item.name | default('br-mgmt') }}" @@ -169,7 +169,7 @@ - name: Shut down the alias interface (RedHat) command: "ifdown {{ item.name | default('br-mgmt') }}:0" when: - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] - network_interfaces_rhel | changed - item.alias is defined with_items: "{{ bridges }}" @@ -184,7 +184,7 @@ - name: Start the alias interface (RedHat) command: "ifup {{ item.name | default('br-mgmt') }}:0" when: - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] - network_interfaces_rhel | changed - item.alias is defined with_items: "{{ bridges }}" diff --git a/test-setup-cinder-localhost.yml b/test-setup-cinder-localhost.yml index e3da2b59..3c26d043 100644 --- a/test-setup-cinder-localhost.yml +++ b/test-setup-cinder-localhost.yml @@ -22,11 +22,11 @@ name: lvm2 when: - ansible_pkg_mgr == 'apt' - - name: Install lvm2 yum package - yum: + - name: Install lvm2 package + package: name: lvm2 when: - - ansible_pkg_mgr == 'yum' + - ansible_pkg_mgr in ['yum', 'dnf'] - name: Create sparse Cinder file shell: "truncate -s 10G /openstack/cinder.img" args: