From 292ee292759b5ec132bffea7f1163cd8d0d0dac3 Mon Sep 17 00:00:00 2001 From: Chris Alfonso Date: Thu, 6 Apr 2017 11:02:01 -0600 Subject: [PATCH] Fixes loginBanner plucking over eapi transport when loginBanner isn't set. (#23368) --- lib/ansible/modules/network/eos/eos_banner.py | 3 ++- test/integration/group_vars/eos.yaml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/network/eos/eos_banner.py b/lib/ansible/modules/network/eos/eos_banner.py index 900f7c82657..66a11bfc9ea 100644 --- a/lib/ansible/modules/network/eos/eos_banner.py +++ b/lib/ansible/modules/network/eos/eos_banner.py @@ -121,7 +121,8 @@ def map_config_to_obj(module): else: # On EAPI we need to extract the banner text from dict key # 'loginBanner' - obj['text'] = output[0]['loginBanner'].strip('\n') + if isinstance(output[0], dict) and 'loginBanner' in output[0].keys(): + obj['text'] = output[0]['loginBanner'].strip('\n') obj['state'] = 'present' return obj diff --git a/test/integration/group_vars/eos.yaml b/test/integration/group_vars/eos.yaml index 67e6675ae7e..614a7b22f62 100644 --- a/test/integration/group_vars/eos.yaml +++ b/test/integration/group_vars/eos.yaml @@ -12,4 +12,5 @@ eapi: password: "{{ eos_eapi_pass | default('admin') }}" transport: eapi use_ssl: no + port: 80 authorize: yes