Make SELinux enforcing/permisssive configurable for tests

When running tests using run_tests.sh, we want to have the option
to select if we want to run SELinux in enforcing (default) or
permissive mode.

Change-Id: I76776ff975a251c62f70c826913cd329b57c20c3
(cherry picked from commit 14e0eaaa35)
This commit is contained in:
Javier Pena 2017-05-23 17:37:18 +02:00 committed by Alfredo Moralejo
parent 514fc80522
commit 39327feb59
1 changed files with 8 additions and 0 deletions

View File

@ -24,6 +24,7 @@ DELOREAN=${DELOREAN:-http://trunk.rdoproject.org/centos7-newton/current-passed-c
DELOREAN_DEPS=${DELOREAN_DEPS:-http://trunk.rdoproject.org/centos7-newton/delorean-deps.repo}
GIT_BASE_URL=${GIT_BASE_URL:-git://git.openstack.org}
ADDITIONAL_ARGS=${ADDITIONAL_ARGS:-}
SELINUX_ENFORCING=${SELINUX_ENFORCING:-true}
# If logs should be retrieved automatically
COPY_LOGS=${COPY_LOGS:-true}
@ -134,6 +135,13 @@ echo "${USER} hard nofile 65536" | $SUDO tee -a /etc/security/limits.conf
echo "root soft nofile 65536" | $SUDO tee -a /etc/security/limits.conf
echo "root hard nofile 65536" | $SUDO tee -a /etc/security/limits.conf
# Set SELinux to enforcing/permissive as needed
if [ "${SELINUX_ENFORCING}" = true ]; then
$SUDO setenforce 1
else
$SUDO setenforce 0
fi
# Setup repositories
if [ "${MANAGE_REPOS}" = true ]; then
$SUDO curl -L ${DELOREAN} -o /etc/yum.repos.d/delorean.repo