mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user