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

Properly handle check for session support on eos #56407

Merged
merged 3 commits into from May 16, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -0,0 +1,2 @@
minor_changes:
- eos_use_sessions is now type boolean instead of int.
@@ -30,8 +30,8 @@
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 @@ def get_diff(self, candidate=None, running=None, diff_match='line', diff_ignore_
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

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.