Add SUSE support

Add support for SUSE based distributions. We also update the bindep.txt,
run_tests.sh and Vagrantfile files from the openstack-ansible-tests
repository.

Change-Id: I9dd0290d9eb7be77446a6bd5c048ceb3371fa536
This commit is contained in:
Markos Chandras 2017-04-05 18:24:52 +01:00
parent 19615e4713
commit 5a150eee9b
8 changed files with 113 additions and 64 deletions

1
.gitignore vendored
View File

@ -61,6 +61,7 @@ ChangeLog
releasenotes/build
# Test temp files
tests/common
tests/plugins
tests/playbooks
tests/test.retry

30
Vagrantfile vendored
View File

@ -1,8 +1,34 @@
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provision "shell", inline: <<-SHELL
config.vm.provider "virtualbox" do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.define "ubuntu1604" do |xenial|
xenial.vm.box = "ubuntu/xenial64"
xenial.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
end
config.vm.define "opensuse421" do |leap421|
leap421.vm.box = "opensuse/openSUSE-42.1-x86_64"
leap421.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
end
config.vm.define "centos7" do |centos7|
centos7.vm.box = "centos/7"
centos7.vm.provision "shell", inline: <<-SHELL
sudo su -
cd /vagrant
./run_tests.sh
SHELL
end
end

View File

@ -3,12 +3,24 @@
#
# See the following for details:
# - http://docs.openstack.org/infra/bindep/
# - https://github.com/openstack-infra/bindep
# - https://git.openstack.org/cgit/openstack-infra/bindep
#
# Even if the role does not make use of this facility, it
# is better to have this file empty, otherwise OpenStack-CI
# will fall back to installing its default packages which
# will potentially be detrimental to the tests executed.
#
# Note:
# This file is maintained in the openstack-ansible-tests repository.
# https://git.openstack.org/cgit/openstack/openstack-ansible-tests/tree/bindep.txt
# If you need to remove or add extra dependencies, you should modify
# the central file instead and once your change is accepted then update
# this file as well. The purpose of this file is to ensure that Python and
# Ansible have all their necessary binary requirements on the test host before
# tox executes. Any binary requirements needed by services/roles should be
# installed by those roles in their applicable package install tasks, not through
# using this file.
#
# Base requirements for Ubuntu
build-essential [platform:dpkg]
@ -18,24 +30,26 @@ libffi-dev [platform:dpkg]
python2.7 [platform:dpkg]
python-dev [platform:dpkg]
# Base requirements for CentOS
# Base requirements for RPM distros
gcc [platform:rpm]
gcc-c++ [platform:rpm]
git [platform:rpm]
python-devel [platform:rpm]
libffi-devel [platform:rpm]
openssl-devel [platform:rpm]
python-devel [platform:rpm]
# For SELinux
libselinux-python [platform:rpm]
libselinux-python [platform:centos]
libsemanage-python [platform:centos]
# For SSL SNI support
python-pyasn1 [platform:dpkg]
python-openssl [platform:dpkg]
python-pyasn1 [platform:dpkg platform:suselinux]
python-openssl [platform:dpkg platform:suselinux]
python-ndg-httpsclient [platform:ubuntu]
python2-pyasn1 [platform:rpm]
python2-pyOpenSSL [platform:rpm]
python-ndg_httpsclient [platform:rpm]
python2-pyasn1 [platform:centos]
python2-pyOpenSSL [platform:centos]
python-pyOpenSSL [platform:suselinux]
python-ndg_httpsclient [platform:centos]
# Required for compressing collected log files in CI
gzip

View File

@ -26,6 +26,9 @@ galaxy_info:
- name: EL
versions:
- 7
- name: opensuse
versions:
- all
categories:
- client
- rsyslog

View File

@ -13,62 +13,35 @@
# See the License for the specific language governing permissions and
# limitations under the License.
set -xeuo pipefail
set -xeu
FUNCTIONAL_TEST=${FUNCTIONAL_TEST:-true}
source /etc/os-release || /usr/lib/os-release
# Install python2 for Ubuntu 16.04 and CentOS 7
if which apt-get; then
sudo apt-get update && sudo apt-get install -y python
fi
install_pkg_deps() {
pkg_deps="git"
if which yum; then
sudo yum install -y python
fi
case ${ID,,} in
*suse*) pkg_mgr_cmd="zypper -n in" ;;
centos|rhel) pkg_mgr_cmd="yum install -y" ;;
fedora) pkg_mgr_cmd="dnf -y install" ;;
ubuntu|debian) pkg_mgr_cmd="apt-get install -y" ;;
*) echo "unsupported distribution: ${ID,,}"; exit 1 ;;
esac
# Install pip.
if ! which pip; then
curl --silent --show-error --retry 5 \
https://bootstrap.pypa.io/get-pip.py | sudo python2.7
fi
eval sudo $pkg_mgr_cmd $pkg_deps
}
# Install bindep and tox with pip.
sudo pip install bindep tox
# CentOS 7 requires two additional packages:
# redhat-lsb-core - for bindep profile support
# epel-release - required to install python-ndg_httpsclient/python2-pyasn1
if which yum; then
sudo yum -y install redhat-lsb-core epel-release
fi
# Get a list of packages to install with bindep. If packages need to be
# installed, bindep exits with an exit code of 1.
BINDEP_PKGS=$(bindep -b -f bindep.txt test || true)
echo "Packages to install: ${BINDEP_PKGS}"
# Install a list of OS packages provided by bindep.
if which apt-get; then
sudo apt-get update
DEBIAN_FRONTEND=noninteractive \
sudo apt-get -q --option "Dpkg::Options::=--force-confold" \
--assume-yes install $BINDEP_PKGS
elif which yum; then
# Don't run yum with an empty list of packages.
# It will fail and cause the script to exit with an error.
if [[ ${#BINDEP_PKGS} > 0 ]]; then
sudo yum install -y $BINDEP_PKGS
git_clone_repo() {
if [[ ! -d tests/common ]]; then
git clone https://git.openstack.org/openstack/openstack-ansible-tests tests/common
fi
fi
}
# Loop through each tox environment and run tests.
for tox_env in $(awk -F= '/envlist/ { gsub(",", " "); print $2 }' tox.ini); do
echo "Executing tox environment: ${tox_env}"
if [[ ${tox_env} == ansible-functional ]]; then
if ${FUNCTIONAL_TEST}; then
tox -e ${tox_env}
fi
else
tox -e ${tox_env}
fi
done
install_pkg_deps
git_clone_repo
# start executing the main test script
source tests/common/run_tests.sh
# vim: set ts=4 sw=4 expandtab:

View File

@ -32,3 +32,10 @@
state: "directory"
owner: "syslog"
group: "adm"
- name: Remove conflicting distro packages
package:
name: "{{ item }}"
state: absent
with_items:
- "{{ rsyslog_client_distro_packages_remove | default([]) }}"

View File

@ -93,8 +93,10 @@
# check for a log file that should be discovered via rsyslog_client_log_dir
# /var/log/kern.log should exist on Ubuntu
# /var/log/yum.log should exist on CentOS
# /var/log/zypper.log should exist on openSUSE
- "'/var/log/kern.log' in logrotate_client_content
or '/var/log/yum.log' in logrotate_client_content"
or '/var/log/yum.log' in logrotate_client_content
or '/var/log/zypper.log' in logrotate_client_content"
- "'size 1G' in logrotate_client_content"
- "rsyslog_default_file.stat.exists"
- "rsyslog_remote_logging_conf.stat.exists"

23
vars/suse-42.yml Normal file
View File

@ -0,0 +1,23 @@
---
# Copyright 2017, SUSE LINUX GmbH.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
rsyslog_client_distro_packages:
- rsyslog
- logrotate
rsyslog_client_distro_packages_remove:
- systemd-logger # conflicts with rsyslog
rsyslog_client_reload: 'systemctl -q restart rsyslogd || true'