mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Check for proper response key on eos_banner map_config_to_obj (#23399)
If we run the task with 'login' banner, the 'show banner' command will return a dict containing key 'loginBanner'. However for motd, it will just return 'motd'. Yay naming consistency!
This commit is contained in:
parent
ce9826d76e
commit
ba7ba7adc3
1 changed files with 6 additions and 2 deletions
|
@ -121,8 +121,12 @@ def map_config_to_obj(module):
|
||||||
else:
|
else:
|
||||||
# On EAPI we need to extract the banner text from dict key
|
# On EAPI we need to extract the banner text from dict key
|
||||||
# 'loginBanner'
|
# 'loginBanner'
|
||||||
if isinstance(output[0], dict) and 'loginBanner' in output[0].keys():
|
if module.params['banner'] == 'login':
|
||||||
obj['text'] = output[0]['loginBanner'].strip('\n')
|
banner_response_key = 'loginBanner'
|
||||||
|
else:
|
||||||
|
banner_response_key = 'motd'
|
||||||
|
if isinstance(output[0], dict) and banner_response_key in output[0].keys():
|
||||||
|
obj['text'] = output[0][banner_response_key].strip('\n')
|
||||||
obj['state'] = 'present'
|
obj['state'] = 'present'
|
||||||
return obj
|
return obj
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue