eos_config: Fix test issues (#56180)

* Alter tests to pass

* Change diff_against to make changed work again

* Add another diff_against

* Expose supports_sessions across all EOS connection types

* Change session warning to failure

* supports_sessions needs to be a method to survive the rpc boundary

* Alter tests to match
This commit is contained in:
Nathaniel Case
2019-05-09 08:32:25 -04:00
committed by Sumit Jaiswal
parent a7bf728555
commit 0bead3672f
6 changed files with 109 additions and 69 deletions

View File

@@ -396,6 +396,10 @@ def main():
flags = ['all'] if module.params['defaults'] else []
connection = get_connection(module)
# Refuse to diff_against: session if essions are disabled
if module.params['diff_against'] == 'session' and not connection.supports_sessions:
module.fail_json(msg="Cannot diff against sessions when sessions are disabled. Please change diff_against to another value")
if module.params['backup'] or (module._diff and module.params['diff_against'] == 'running'):
contents = get_config(module, flags=flags)
config = NetworkConfig(indent=1, contents=contents)