mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
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:
committed by
Sumit Jaiswal
parent
a7bf728555
commit
0bead3672f
@@ -121,6 +121,12 @@ class Cli:
|
||||
self._session_support = None
|
||||
self._connection = None
|
||||
|
||||
@property
|
||||
def supports_sessions(self):
|
||||
if self._session_support is None:
|
||||
self._session_support = self._get_connection().supports_sessions()
|
||||
return self._session_support
|
||||
|
||||
def _get_connection(self):
|
||||
if self._connection:
|
||||
return self._connection
|
||||
@@ -230,10 +236,9 @@ class LocalEapi:
|
||||
|
||||
@property
|
||||
def supports_sessions(self):
|
||||
if self._session_support:
|
||||
return self._session_support
|
||||
response = self.send_request(['show configuration sessions'])
|
||||
self._session_support = 'error' not in response
|
||||
if self._session_support is None:
|
||||
response = self.send_request(['show configuration sessions'])
|
||||
self._session_support = 'error' not in response
|
||||
return self._session_support
|
||||
|
||||
def _request_builder(self, commands, output, reqid=None):
|
||||
@@ -428,6 +433,12 @@ class HttpApi:
|
||||
|
||||
return self._connection_obj
|
||||
|
||||
@property
|
||||
def supports_sessions(self):
|
||||
if self._session_support is None:
|
||||
self._session_support = self._connection.supports_sessions()
|
||||
return self._session_support
|
||||
|
||||
def run_commands(self, commands, check_rc=True):
|
||||
"""Runs list of commands on remote device and returns results
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user