Skip to content

Commit

Permalink
Fix firewalld module failing on missing protocol. (ansible#50242)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ericzolf authored and maxamillion committed Jan 2, 2019
1 parent 23706db commit 69deb73
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ansible/modules/system/firewalld.py
Expand Up @@ -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
Expand Down

0 comments on commit 69deb73

Please sign in to comment.