@ -114,9 +114,6 @@ try:
from firewall . client import Rich_Rule
from firewall . client import Rich_Rule
from firewall . client import FirewallClient
from firewall . client import FirewallClient
fw = FirewallClient ( )
fw = FirewallClient ( )
if not fw . connected :
HAS_FIREWALLD = False
else :
HAS_FIREWALLD = True
HAS_FIREWALLD = True
except ImportError :
except ImportError :
HAS_FIREWALLD = False
HAS_FIREWALLD = False
@ -359,6 +356,13 @@ def main():
## Pre-run version checking
## Pre-run version checking
if FW_VERSION < " 0.2.11 " :
if FW_VERSION < " 0.2.11 " :
module . fail_json ( msg = ' unsupported version of firewalld, requires >= 2.0.11 ' )
module . fail_json ( msg = ' unsupported version of firewalld, requires >= 2.0.11 ' )
## Check for firewalld running
try :
if fw . connected == False :
module . fail_json ( msg = ' firewalld service must be running ' )
except AttributeError :
module . fail_json ( msg = " firewalld connection can ' t be established, \
installed version ( % s ) likely too old . Requires firewalld > = 2.0 .11 " % F W_VERSION)
## Global Vars
## Global Vars
changed = False
changed = False
@ -386,14 +390,6 @@ def main():
interface = module . params [ ' interface ' ]
interface = module . params [ ' interface ' ]
masquerade = module . params [ ' masquerade ' ]
masquerade = module . params [ ' masquerade ' ]
## Check for firewalld running
try :
if fw . connected == False :
module . fail_json ( msg = ' firewalld service must be running ' )
except AttributeError :
module . fail_json ( msg = " firewalld connection can ' t be established, \
version likely too old . Requires firewalld > = 2.0 .11 " )
modification_count = 0
modification_count = 0
if service != None :
if service != None :
modification_count + = 1
modification_count + = 1