Fix firewalld module failing on missing protocol. (#50242)

Under Python 3.7 at least, the split of the port field fails
ungracefully if there is no slash. The fix also addresses the
case of an empty protocol after the slash.
pull/50354/head^2
Eric L 6 years ago committed by Adam Miller
parent 23706dbc20
commit 69deb73803

@ -679,8 +679,11 @@ def main():
zone = module.params['zone']
if module.params['port'] is not None:
port, protocol = module.params['port'].strip().split('/')
if protocol is None:
if '/' in module.params['port']:
port, protocol = module.params['port'].strip().split('/')
else:
protocol = None
if not protocol:
module.fail_json(msg='improper port format (missing protocol?)')
else:
port = None

Loading…
Cancel
Save