From 5fbe64a3244192139d8a9028f0ec0753fb8b47d4 Mon Sep 17 00:00:00 2001 From: Gabriele Date: Tue, 14 Feb 2017 18:10:46 +0100 Subject: [PATCH] Fixing nxos modules when interface is loopback (#20645) * Fixing modules when interface is loopback * Remove capitalize --- lib/ansible/modules/network/nxos/nxos_interface_ospf.py | 3 +++ lib/ansible/modules/network/nxos/nxos_vrf_interface.py | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/nxos/nxos_interface_ospf.py b/lib/ansible/modules/network/nxos/nxos_interface_ospf.py index 4642f7f3210..36fbf5cd282 100644 --- a/lib/ansible/modules/network/nxos/nxos_interface_ospf.py +++ b/lib/ansible/modules/network/nxos/nxos_interface_ospf.py @@ -604,6 +604,9 @@ def main(): 'message_digest_password']], supports_check_mode=True) + if not module.params['interface'].startswith('loopback'): + module.params['interface'] = module.params['interface'].capitalize() + for param in ['message_digest_encryption_type', 'message_digest_algorithm_type', 'message_digest_password']: diff --git a/lib/ansible/modules/network/nxos/nxos_vrf_interface.py b/lib/ansible/modules/network/nxos/nxos_vrf_interface.py index 1a9f96c753e..b007040102d 100644 --- a/lib/ansible/modules/network/nxos/nxos_vrf_interface.py +++ b/lib/ansible/modules/network/nxos/nxos_vrf_interface.py @@ -385,7 +385,9 @@ def get_vrf_list(module): def get_interface_info(interface, module): - command = 'show run | section interface.{0}'.format(interface.capitalize()) + if not interface.startswith('loopback'): + interface = interface.capitalize() + command = 'show run | section interface.{0}'.format(interface) vrf_regex = ".*vrf\s+member\s+(?P\S+).*" try: