1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

always make to/from_service None if ports are assigned

This commit is contained in:
Kelly Brazil
2021-04-21 07:08:50 -07:00
parent c60549a994
commit e4acb3d5b7

View File

@ -380,13 +380,15 @@ def _parse_to_from(linedata, direction, rule_obj=None):
# find the numeric port(s) # find the numeric port(s)
linedata_list = linedata.split(':', maxsplit=1) linedata_list = linedata.split(':', maxsplit=1)
if len(linedata_list) == 2 and linedata_list[1].strip().isnumeric(): if len(linedata_list) == 2 and linedata_list[0].strip().isnumeric():
rule_obj[direction + '_start_port'] = linedata_list[0].strip() rule_obj[direction + '_start_port'] = linedata_list[0].strip()
rule_obj[direction + '_end_port'] = linedata_list[1].strip() rule_obj[direction + '_end_port'] = linedata_list[1].strip()
rule_obj[direction + '_service'] = None
linedata = '' linedata = ''
elif len(linedata_list) == 1 and linedata_list[0].strip().isnumeric(): elif len(linedata_list) == 1 and linedata_list[0].strip().isnumeric():
rule_obj[direction + '_start_port'] = linedata_list[0].strip() rule_obj[direction + '_start_port'] = linedata_list[0].strip()
rule_obj[direction + '_end_port'] = linedata_list[0].strip() rule_obj[direction + '_end_port'] = linedata_list[0].strip()
rule_obj[direction + '_service'] = None
linedata = '' linedata = ''
# only thing left should be the service name. # only thing left should be the service name.