Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not assert session name on idempotent eos banner #23402

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/ansible/modules/network/eos/eos_banner.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,12 @@ def map_config_to_obj(module):
else:
# On EAPI we need to extract the banner text from dict key
# 'loginBanner'
if isinstance(output[0], dict) and 'loginBanner' in output[0].keys():
obj['text'] = output[0]['loginBanner'].strip('\n')
if module.params['banner'] == 'login':
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'
return obj

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
- "result.changed == false"
- "result.commands | length == 0"
# Ensure sessions contains epoc. Will fail after 18th May 2033
- "result.session_name contains 'ansible_1'"
- "result.session_name is not defined"

# FIXME add in tests for everything defined in docs
# FIXME Test state:absent + test:
Expand Down