MCPcopy Create free account
hub / github.com/apache/cloudstack / allowPort

Method allowPort

python/lib/cloudutils/serviceConfig.py:801–818  ·  view source on GitHub ↗
(self, port)

Source from the content-addressed store, hash-verified

799 self.rules = []
800
801 def allowPort(self, port):
802 status = False
803 try:
804 status = bash("iptables-save|grep INPUT|grep -w %s"%port).isSuccess()
805 except:
806 pass
807
808 if not status:
809 redo = False
810 result = True
811 try:
812 result = bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port).isSuccess()
813 except:
814 redo = True
815
816 if not result or redo:
817 bash("sleep 30")
818 bash("iptables -I INPUT -p tcp -m tcp --dport %s -j ACCEPT"%port)
819
820 def config(self):
821 try:

Callers 1

configMethod · 0.95

Calls 2

bashClass · 0.85
isSuccessMethod · 0.65

Tested by

no test coverage detected