Fix ios_l2_interface vlan bug CP in 2.6 (#44445)

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

(cherry picked from commit 401c45384e)

* Added changelog
pull/44302/merge
Nilashish Chakraborty 6 years ago committed by Matt Clay
parent 1bcc192580
commit 02ef320c24

@ -0,0 +1,3 @@
---
bugfixes:
- ios_l2_interface - fix bug when list of vlans ends with comma (https://github.com/ansible/ansible/pull/43879)

@ -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)

Loading…
Cancel
Save