From ed30858f5009b8040e0d8ae306ccf0c5b819b5bf Mon Sep 17 00:00:00 2001 From: Sumit Jaiswal Date: Tue, 3 Mar 2020 06:52:10 +0530 Subject: [PATCH] Backport PR to fix the bug where IOS vlans module throws traceback (#67336) * To fix the bug where IOS vlans module throws traceback (#64633) * fix 64515 * add fix (cherry picked from commit c5a2ba5217dbb75998f61d86b83700b912f29054) * changelog --- changelogs/fragments/64633-fix-ios-vlans-traceback-error.yaml | 2 ++ lib/ansible/module_utils/network/ios/facts/vlans/vlans.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/64633-fix-ios-vlans-traceback-error.yaml diff --git a/changelogs/fragments/64633-fix-ios-vlans-traceback-error.yaml b/changelogs/fragments/64633-fix-ios-vlans-traceback-error.yaml new file mode 100644 index 00000000000..9da39c91e21 --- /dev/null +++ b/changelogs/fragments/64633-fix-ios-vlans-traceback-error.yaml @@ -0,0 +1,2 @@ +bugfixes: +- "fix the bug where IOS vlans module throws traceback. (ref: https://github.com/ansible/ansible/pull/64633)" diff --git a/lib/ansible/module_utils/network/ios/facts/vlans/vlans.py b/lib/ansible/module_utils/network/ios/facts/vlans/vlans.py index 0450ad9a398..b499be5ce9a 100644 --- a/lib/ansible/module_utils/network/ios/facts/vlans/vlans.py +++ b/lib/ansible/module_utils/network/ios/facts/vlans/vlans.py @@ -111,7 +111,7 @@ class VlansFacts(object): config = deepcopy(spec) if vlan_info == 'Name' and 'Name' not in conf: - conf = filter(None, conf.split(' ')) + conf = list(filter(None, conf.split(' '))) config['vlan_id'] = int(conf[0]) config['name'] = conf[1] if len(conf[2].split('/')) > 1: @@ -127,7 +127,7 @@ class VlansFacts(object): config['state'] = 'active' config['shutdown'] = 'disabled' elif vlan_info == 'Type' and 'Type' not in conf: - conf = filter(None, conf.split(' ')) + conf = list(filter(None, conf.split(' '))) config['mtu'] = int(conf[3]) elif vlan_info == 'Remote': if len(conf.split(',')) > 1 or conf.isdigit():