From 654a38897f550caf3ff6847fd0a338fa37a88e7d Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Fri, 23 Sep 2016 16:09:14 -0400 Subject: [PATCH] fixes exception raised when nxos_facts uses nxapi transport (#4988) This fixes a condition where an exception is raised when collecting `interface` facts and the transport is set to nxapi in the nxos_nxapi module. fixes ansible/ansible#17691 --- lib/ansible/modules/network/nxos/nxos_facts.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/network/nxos/nxos_facts.py b/lib/ansible/modules/network/nxos/nxos_facts.py index af8df350710..ff9c454aaa6 100644 --- a/lib/ansible/modules/network/nxos/nxos_facts.py +++ b/lib/ansible/modules/network/nxos/nxos_facts.py @@ -276,11 +276,11 @@ class Interfaces(FactsBase): def commands(self): add_command(self.runner, 'show interface', output='json') - resp = self.module.cli(['show ipv6 interface | wc lines']) - if int(resp[0]) > 1: + try: + self.module.cli('show ipv6 interface', 'json') add_command(self.runner, 'show ipv6 interface', output='json') self.ipv6 = True - else: + except NetworkError: self.ipv6 = False try: