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

FIX ISSUE:#43878 when the vlans string have a final comma. (#43879)

This commit is contained in:
Clement Trebuchet 2018-08-20 09:18:46 +02:00 committed by Nilashish Chakraborty
parent 167c389270
commit 401c45384e

View file

@ -303,11 +303,12 @@ def vlan_range_to_list(vlans):
for part in vlans.split(','):
if part.lower() == 'none':
break
if '-' in part:
start, stop = (int(i) for i in part.split('-'))
result.extend(range(start, stop + 1))
else:
result.append(int(part))
if part:
if '-' in part:
start, stop = (int(i) for i in part.split('-'))
result.extend(range(start, stop + 1))
else:
result.append(int(part))
return sorted(result)