From 19a6000d97c4a55a5285b2b22baa1f9e55e17b62 Mon Sep 17 00:00:00 2001 From: Nathaniel Case Date: Mon, 14 Aug 2017 15:18:10 -0400 Subject: [PATCH] Fix nxos_bgp_af networks parameter (#28169) * Split 'networks' and 'redistribute' in get_value * Add missing `'` in docs --- lib/ansible/modules/network/nxos/nxos_bgp_af.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_bgp_af.py b/lib/ansible/modules/network/nxos/nxos_bgp_af.py index c92c4607f6..8b82653546 100644 --- a/lib/ansible/modules/network/nxos/nxos_bgp_af.py +++ b/lib/ansible/modules/network/nxos/nxos_bgp_af.py @@ -198,7 +198,7 @@ options: prefixes to advertise. The list must be in the form of an array. Each entry in the array must include a prefix address and an optional route-map. For example [['10.0.0.0/16', 'routemap_LA'], - ['192.168.1.1', 'Chicago'], ['192.168.2.0/24], + ['192.168.1.1', 'Chicago'], ['192.168.2.0/24'], ['192.168.3.0/24', 'routemap_NYC']]. required: false default: null @@ -359,7 +359,12 @@ def get_value(arg, config, module): if inject_re.search(config): value.append('copy_attributes') - elif arg in ['networks', 'redistribute']: + elif arg == 'networks': + value = [] + for network in command_val_re.findall(config): + value.append(network.split()) + + elif arg == 'redistribute': value = [] if has_command_val: value = has_command_val.group('value').split() @@ -367,9 +372,8 @@ def get_value(arg, config, module): if value: if len(value) == 3: value.pop(1) - elif arg == 'redistribute' and len(value) == 4: - value = ['{0} {1}'.format( - value[0], value[1]), value[3]] + elif len(value) == 4: + value = ['{0} {1}'.format(value[0], value[1]), value[3]] elif command == 'distance': distance_re = r'.*distance\s(?P\w+)\s(?P\w+)\s(?P\w+)'