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:
parent
23706dbc20
commit
69deb73803
1 changed files with 5 additions and 2 deletions
|
@ -679,8 +679,11 @@ def main():
|
||||||
zone = module.params['zone']
|
zone = module.params['zone']
|
||||||
|
|
||||||
if module.params['port'] is not None:
|
if module.params['port'] is not None:
|
||||||
|
if '/' in module.params['port']:
|
||||||
port, protocol = module.params['port'].strip().split('/')
|
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?)')
|
module.fail_json(msg='improper port format (missing protocol?)')
|
||||||
else:
|
else:
|
||||||
port = None
|
port = None
|
||||||
|
|
Loading…
Reference in a new issue