Accept other ios_banner types (#33961)

* Accept other ios_banner types

* Use 2.6-compatible format string

* Doc option values prior to this update
This commit is contained in:
Jim Pfleger 2018-01-03 07:38:14 -07:00 committed by John R Barker
parent 798aa8a2d2
commit af236f2531
2 changed files with 8 additions and 7 deletions

View file

@ -37,11 +37,11 @@ notes:
options: options:
banner: banner:
description: description:
- Specifies which banner that should be - Specifies which banner should be configured on the remote device.
configured on the remote device. In Ansible 2.4 and earlier only I(login) and I(motd) were supported.
required: true required: true
default: null default: null
choices: ['login', 'motd'] choices: ['login', 'motd', 'exec', 'incoming', 'slip-ppp']
text: text:
description: description:
- The banner text that should be - The banner text that should be
@ -151,7 +151,7 @@ def main():
""" main entry point for module execution """ main entry point for module execution
""" """
argument_spec = dict( argument_spec = dict(
banner=dict(required=True, choices=['login', 'motd']), banner=dict(required=True, choices=['login', 'motd', 'exec', 'incoming', 'slip-ppp']),
text=dict(), text=dict(),
state=dict(default='present', choices=['present', 'absent']) state=dict(default='present', choices=['present', 'absent'])
) )

View file

@ -46,9 +46,10 @@ class TestIosBannerModule(TestIosModule):
self.load_config.return_value = dict(diff=None, session='session') self.load_config.return_value = dict(diff=None, session='session')
def test_ios_banner_create(self): def test_ios_banner_create(self):
set_module_args(dict(banner='login', text='test\nbanner\nstring')) for banner_type in ('login', 'motd', 'exec', 'incoming', 'slip-ppp'):
commands = ['banner login @\ntest\nbanner\nstring\n@'] set_module_args(dict(banner=banner_type, text='test\nbanner\nstring'))
self.execute_module(changed=True, commands=commands) commands = ['banner {0} @\ntest\nbanner\nstring\n@'.format(banner_type)]
self.execute_module(changed=True, commands=commands)
def test_ios_banner_remove(self): def test_ios_banner_remove(self):
set_module_args(dict(banner='login', state='absent')) set_module_args(dict(banner='login', state='absent'))