From d3a9f7736188878a9feb47c32c731b79e1c20b4b Mon Sep 17 00:00:00 2001 From: saichint Date: Mon, 11 Jun 2018 22:16:47 -0700 Subject: [PATCH] fix get existing vpc issue (#41429) (cherry picked from commit 00ce205535fe6899e771a2ee195e5cc2173bbaab) --- lib/ansible/modules/network/nxos/nxos_vpc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/nxos/nxos_vpc.py b/lib/ansible/modules/network/nxos/nxos_vpc.py index cff0a9a7e5e..794cc1215e1 100644 --- a/lib/ansible/modules/network/nxos/nxos_vpc.py +++ b/lib/ansible/modules/network/nxos/nxos_vpc.py @@ -178,7 +178,15 @@ def get_auto_recovery_default(module): def get_vpc(module): body = run_commands(module, ['show vpc | json'])[0] - domain = str(body['vpc-domain-id']) + if body: + domain = str(body['vpc-domain-id']) + else: + body = run_commands(module, ['show run vpc | inc domain'])[0] + if body: + domain = body.split()[2] + else: + domain = 'not configured' + vpc = {} if domain != 'not configured': run = get_config(module, flags=['vpc'])