From 72be91647cb5d90d7c4ed5f77da840abc9288ec3 Mon Sep 17 00:00:00 2001 From: itnihao Date: Sun, 15 Dec 2013 17:42:18 +0800 Subject: [PATCH] fix return null iptables.append return null in iptables.append,fix it ``` salt 'node1' iptables.append filter INPUT rule='-s 0.0.0.0 -p tcp --dport 80 -j ACCEPT' node1: True salt 'node1' iptables.append filter INPUT rule='-s 0.0.0.0 -p tcp --dport 80 -j ACCEPT4' node1: False ``` --- salt/modules/iptables.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/salt/modules/iptables.py b/salt/modules/iptables.py index b8c38a3d17..bfe31b21b0 100644 --- a/salt/modules/iptables.py +++ b/salt/modules/iptables.py @@ -407,7 +407,10 @@ def append(table='filter', chain=None, rule=None): cmd = 'iptables -t {0} -A {1} {2}'.format(table, chain, rule) out = __salt__['cmd.run'](cmd) - return out + if len(out) == 0 : + return True + else: + return False def insert(table='filter', chain=None, position=None, rule=None):