From 42d79a982815cff83ed6e89b269b45c982b906b6 Mon Sep 17 00:00:00 2001 From: Luigi Toscano Date: Tue, 11 Oct 2016 17:51:57 +0200 Subject: [PATCH] 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 --- elements/disable-firewall/post-install.d/30-disable-firewalld | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elements/disable-firewall/post-install.d/30-disable-firewalld b/elements/disable-firewall/post-install.d/30-disable-firewalld index 277d552e..fc2240db 100755 --- a/elements/disable-firewall/post-install.d/30-disable-firewalld +++ b/elements/disable-firewall/post-install.d/30-disable-firewalld @@ -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 ;;