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.
This commit is contained in:
Eric L 2019-01-02 18:09:42 +01:00 committed by Adam Miller
parent 23706dbc20
commit 69deb73803

View file

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