From f9a62145f0675b0ad5c1c3da9a710b33c7cd6620 Mon Sep 17 00:00:00 2001 From: Edison Su Date: Wed, 15 Feb 2012 14:50:28 -0800 Subject: [PATCH] bug 13647: adding iptables rules failed, sleep and retry status 13647: resolved fixed Reviewed-by: Frank --- python/lib/cloudutils/serviceConfig.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/python/lib/cloudutils/serviceConfig.py b/python/lib/cloudutils/serviceConfig.py index afa49c88568..a5e90bcc751 100755 --- a/python/lib/cloudutils/serviceConfig.py +++ b/python/lib/cloudutils/serviceConfig.py @@ -535,7 +535,16 @@ class firewallConfigBase(serviceCfgBase): pass if not status: - bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port) + redo = False + result = True + try: + result = bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port).isSuccess() + except: + redo = True + + if not result or redo: + bash("sleep 30") + bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port) def config(self): try: