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(','): for part in vlans.split(','):
if part.lower() == 'none': if part.lower() == 'none':
break break
if '-' in part: if part:
start, stop = (int(i) for i in part.split('-')) if '-' in part:
result.extend(range(start, stop + 1)) start, stop = (int(i) for i in part.split('-'))
else: result.extend(range(start, stop + 1))
result.append(int(part)) else:
result.append(int(part))
return sorted(result) return sorted(result)

Loading…
Cancel
Save