diff --git a/bindep.txt b/bindep.txt index 14f3d5f3..bb77692e 100644 --- a/bindep.txt +++ b/bindep.txt @@ -47,3 +47,4 @@ git [platform:gentoo] # For SELinux libselinux-python3 [platform:redhat] libsemanage-python3 [platform:redhat] +iptables [platform:redhat] diff --git a/run_tests_common.sh b/run_tests_common.sh index 2ad5a694..28b51012 100755 --- a/run_tests_common.sh +++ b/run_tests_common.sh @@ -55,6 +55,7 @@ case "${ID,,}" in # tox later installing virtualenv as a dependancy with pip, and breaking later tests with # openstack_hosts which correctly install the python-virtualenv distro package [[ "${VERSION_ID}" == "7" ]] && extra_redhat_deps="python-virtualenv" + [[ "${VERSION_ID}" == "8" ]] && sudo alternatives --set python /usr/bin/python3 pkg_list="python3-devel redhat-lsb-core yum-utils ${extra_redhat_deps:-}" ;; fedora) diff --git a/test-ansible-env-prep.sh b/test-ansible-env-prep.sh index bc8b5eb1..dd7dfe83 100755 --- a/test-ansible-env-prep.sh +++ b/test-ansible-env-prep.sh @@ -87,11 +87,13 @@ function setup_ara { [[ -L "${ANSIBLE_PLUGIN_DIR}/callback/ara" ]] && return 0 # Dynamically figure out the location of ARA (ex: py2 vs py3) - ara_location=$(python -c "import os,ara; print(os.path.dirname(ara.__file__))") + ara_location=$(python -m ara.setup.callback_plugins 2>/dev/null) - echo "Linking ${ANSIBLE_PLUGIN_DIR}/callback/ara to ${ara_location}/plugins/callbacks/" + echo "Linking ${ara_location} to ${ANSIBLE_PLUGIN_DIR}/callback/ara" mkdir -p "${ANSIBLE_PLUGIN_DIR}/callback/ara" - ln -sf "${ara_location}/plugins/callbacks" "${ANSIBLE_PLUGIN_DIR}/callback/ara/" + if [ -d ${ara_location} ]; then + ln -sf "${ara_location}" "${ANSIBLE_PLUGIN_DIR}/callback/ara/" + fi } @@ -188,12 +190,22 @@ else PIP_OPTS+=" --constraint ${UPPER_CONSTRAINTS_FILE:-https://opendev.org/openstack/requirements/raw/${TESTING_BRANCH}/upper-constraints.txt}" fi +source /etc/os-release || source /usr/lib/os-release +# Install selinux into venv +if [[ ${ID,,} =~ (centos|rhel|fedora) ]]; then + PIP_OPTS+=" selinux" +fi + # Install ARA from source if running in ARA gate, otherwise install from PyPi ARA_SRC_HOME="${TESTING_HOME}/src/opendev.org/recordsansible/ara" if [[ -d "${ARA_SRC_HOME}" ]]; then PIP_OPTS+=" ${ARA_SRC_HOME}" else - PIP_OPTS+=" ara<1.0.0" + if [[ ${VERSION_ID} == "8" && ${ID} == "centos" ]]; then + PIP_OPTS+=" ara<1.0.0;python_version<'3.0' ara[server];python_version>='3.0'" + else + PIP_OPTS+=" ara<1.0.0" + fi fi # Install all python packages @@ -252,18 +264,3 @@ fi # Setup ARA setup_ara - -# Ensure that SElinux bindings are linked into the venv -source /etc/os-release || source /usr/lib/os-release -if [[ ${ID,,} =~ (centos|rhel|fedora) ]]; then - if [ "${ID}" == "fedora" ]; then - SELINUX_PKG="python2-libselinux" - else - SELINUX_PKG="libselinux-python" - fi - - PYTHON_FOLDER=$(find ${VIRTUAL_ENV}/lib -maxdepth 1 -type d -name "python*") - SELINUX_FOLDER=$(rpm -ql ${SELINUX_PKG} | egrep '^.*python2.7.*/(site|dist)-packages/selinux$') - echo "RHEL variant found. Linking ${PYTHON_FOLDER}/site-packages/selinux to ${SELINUX_FOLDER}..." - ln -sfn ${SELINUX_FOLDER} ${PYTHON_FOLDER}/site-packages/selinux -fi diff --git a/test-log-collect.sh b/test-log-collect.sh index 8159b51a..44c63fdd 100755 --- a/test-log-collect.sh +++ b/test-log-collect.sh @@ -200,11 +200,20 @@ store_artifacts /var/log/ "${WORKING_DIR}/logs/host" # As this script is not run through tox, and the tox envs are all # different names, we need to try and find the right path to execute # ARA from. -ARA_CMD="$(find ${WORKING_DIR}/.tox -path "*/bin/ara" -type f | head -n 1)" +source /etc/os-release || source /usr/lib/os-release + +if [[ ${VERSION_ID} == "8" && ${ID} == "centos" ]]; then + #centos-8 is pinned to ara>=1.0 + ARA_CMD="$(find ${WORKING_DIR}/.tox -path "*/bin/ara-manage" -type f | head -n 1)" + ARA_OPTIONS="generate ${WORKING_DIR}/logs/ara-report" +else + ARA_CMD="$(find ${WORKING_DIR}/.tox -path "*/bin/ara" -type f | head -n 1)" + ARA_OPTIONS="generate html ${WORKING_DIR}/logs/ara-report" +fi if [[ "${ARA_CMD}" != "" ]]; then - echo "Generating ARA static html report." - ${ARA_CMD} generate html "${WORKING_DIR}/logs/ara-report" + echo "Generating ARA static html report." + ${ARA_CMD} ${ARA_OPTIONS} fi # Store the ara sqlite database in the openstack-ci expected path @@ -254,7 +263,7 @@ rename_files # If we could not find ARA, assume it was not installed # and skip all the related activities. -if [[ "${ARA_CMD}" != "" ]]; then +if [[ "${ARA_CMD}" != "" && ! (${VERSION_ID} == "8" && ${ID} == "centos") ]]; then # Generate the ARA subunit report so that the # results reflect in OpenStack-Health mkdir -vp "${WORKING_DIR}/logs/ara-data" diff --git a/tests/host_vars/localhost.yml b/tests/host_vars/localhost.yml index 501b20a6..c44d403e 100644 --- a/tests/host_vars/localhost.yml +++ b/tests/host_vars/localhost.yml @@ -21,4 +21,4 @@ bridges: ip_addr: "10.1.2.1" veth_peer: "veth-test" -ansible_python_interpreter: "/usr/bin/python2" +ansible_python_interpreter: "/usr/bin/python"