diff --git a/changelogs/fragments/56407_eos_use_sessions.yaml b/changelogs/fragments/56407_eos_use_sessions.yaml new file mode 100644 index 0000000000..38b57da0f9 --- /dev/null +++ b/changelogs/fragments/56407_eos_use_sessions.yaml @@ -0,0 +1,2 @@ +minor_changes: + - eos_use_sessions is now type boolean instead of int. diff --git a/lib/ansible/plugins/cliconf/eos.py b/lib/ansible/plugins/cliconf/eos.py index 8fca11254f..e69493ab45 100644 --- a/lib/ansible/plugins/cliconf/eos.py +++ b/lib/ansible/plugins/cliconf/eos.py @@ -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