Disable firewalld (also on centos7) when it is enabled

Calling systemctl disable on a non-existing unit leads to a failure due
to `set -e`. This checks prevents it.
Also applies the same codepath to centos7 (as it is for rhel7, also
because centos7 has currently test coverage).

Closes-Bug: #1653535
Change-Id: I21f9cfd1959dcde80ed6abbf410bd0c4e93cc803
This commit is contained in:
Luigi Toscano 2016-10-11 17:51:57 +02:00
parent e6845532bf
commit 42d79a9828
1 changed files with 2 additions and 2 deletions

View File

@ -7,8 +7,8 @@ set -eu
set -o pipefail
case "${DISTRO_NAME}" in
fedora | centos | rhel | rhel7 )
if which systemctl; then
fedora | centos | centos7 | rhel | rhel7 )
if which systemctl && [[ $(systemctl --no-pager list-unit-files firewalld) =~ 'enabled' ]]; then
systemctl disable firewalld
fi
;;