1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Properly handle check for session support on eos (#56407)

* Properly handle eos session check.

* Why is eos_use_sessions an int?

* Add changelog
This commit is contained in:
Nathaniel Case 2019-05-16 10:44:22 -04:00 committed by GitHub
parent f88b660717
commit 409c46b2fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 11 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- eos_use_sessions is now type boolean instead of int.

View file

@ -30,8 +30,8 @@ description:
version_added: "2.4"
options:
eos_use_sessions:
type: int
default: 1
type: boolean
default: yes
description:
- Specifies if sessions should be used on remote host or not
env:
@ -214,20 +214,16 @@ class Cliconf(CliconfBase):
return diff
def supports_sessions(self):
use_session = self.get_option('eos_use_sessions')
try:
use_session = int(use_session)
except ValueError:
pass
if not bool(use_session):
if not self.get_option('eos_use_sessions'):
self._session_support = False
else:
if self._session_support:
return self._session_support
response = self.get('show configuration sessions')
self._session_support = 'error' not in response
try:
self.get('show configuration sessions')
except AnsibleConnectionFailure:
self._session_support = False
return self._session_support