1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

cast http_port, https_port to int from config (#21840)

When retrieving the http_port, https_port values from the configuration
of the device, the values need to cast to int in order to correctly
compare against the argspec values.  This patch fixes that problem.

fixes #21832
This commit is contained in:
Peter Sprygada 2017-02-23 08:05:59 -05:00 committed by John R Barker
parent ab0f992b3a
commit b25c51f99a

View file

@ -192,14 +192,14 @@ def map_obj_to_commands(updates, module):
def parse_http(data):
match = re.search('HTTP Port:\s+(\d+)', data, re.M)
if match:
return {'http': True, 'http_port': match.group(1)}
return {'http': True, 'http_port': int(match.group(1))}
else:
return {'http': False, 'http_port': None}
def parse_https(data):
match = re.search('HTTPS Port:\s+(\d+)', data, re.M)
if match:
return {'https': True, 'https_port': match.group(1)}
return {'https': True, 'https_port': int(match.group(1))}
else:
return {'https': False, 'https_port': None}