From af236f2531f25d36115b5abd9bd128cdf87f0db2 Mon Sep 17 00:00:00 2001 From: Jim Pfleger Date: Wed, 3 Jan 2018 07:38:14 -0700 Subject: [PATCH] Accept other ios_banner types (#33961) * Accept other ios_banner types * Use 2.6-compatible format string * Doc option values prior to this update --- lib/ansible/modules/network/ios/ios_banner.py | 8 ++++---- test/units/modules/network/ios/test_ios_banner.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/ansible/modules/network/ios/ios_banner.py b/lib/ansible/modules/network/ios/ios_banner.py index f3401eaf4d2..4ecb3f49412 100644 --- a/lib/ansible/modules/network/ios/ios_banner.py +++ b/lib/ansible/modules/network/ios/ios_banner.py @@ -37,11 +37,11 @@ notes: options: banner: description: - - Specifies which banner that should be - configured on the remote device. + - Specifies which banner should be configured on the remote device. + In Ansible 2.4 and earlier only I(login) and I(motd) were supported. required: true default: null - choices: ['login', 'motd'] + choices: ['login', 'motd', 'exec', 'incoming', 'slip-ppp'] text: description: - The banner text that should be @@ -151,7 +151,7 @@ def main(): """ main entry point for module execution """ argument_spec = dict( - banner=dict(required=True, choices=['login', 'motd']), + banner=dict(required=True, choices=['login', 'motd', 'exec', 'incoming', 'slip-ppp']), text=dict(), state=dict(default='present', choices=['present', 'absent']) ) diff --git a/test/units/modules/network/ios/test_ios_banner.py b/test/units/modules/network/ios/test_ios_banner.py index e4bd98109d3..418fb50356a 100644 --- a/test/units/modules/network/ios/test_ios_banner.py +++ b/test/units/modules/network/ios/test_ios_banner.py @@ -46,9 +46,10 @@ class TestIosBannerModule(TestIosModule): self.load_config.return_value = dict(diff=None, session='session') def test_ios_banner_create(self): - set_module_args(dict(banner='login', text='test\nbanner\nstring')) - commands = ['banner login @\ntest\nbanner\nstring\n@'] - self.execute_module(changed=True, commands=commands) + for banner_type in ('login', 'motd', 'exec', 'incoming', 'slip-ppp'): + set_module_args(dict(banner=banner_type, text='test\nbanner\nstring')) + commands = ['banner {0} @\ntest\nbanner\nstring\n@'.format(banner_type)] + self.execute_module(changed=True, commands=commands) def test_ios_banner_remove(self): set_module_args(dict(banner='login', state='absent'))