From 22afe036a8a1f54311b662a65e9d768fe507e3ac Mon Sep 17 00:00:00 2001 From: Mike Reeves Date: Tue, 18 Sep 2018 15:38:03 -0400 Subject: [PATCH] addfirewall.sh - add logic so it doesn't retry to add firewall rules --- pillar/firewall/addfirewall.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pillar/firewall/addfirewall.sh b/pillar/firewall/addfirewall.sh index 3d2187f25..7fa6cef5a 100644 --- a/pillar/firewall/addfirewall.sh +++ b/pillar/firewall/addfirewall.sh @@ -5,5 +5,9 @@ POLICY=$1 IPADDRESS=$2 -echo " - $2" >> /opt/so/saltstack/pillar/firewall/$1.sls -salt-call state.apply firewall \ No newline at end of file +if grep -q $2 "/opt/so/saltstack/pillar/firewall/$1.sls"; then + echo "Firewall Rule Already There" +else + echo " - $2" >> /opt/so/saltstack/pillar/firewall/$1.sls + salt-call state.apply firewall +fi