fixes issue in network_cli where _connected wasn't set (#20708)
Adds the code to set and unset the _connected propery in network_cli on calls to open() and close()
This commit is contained in:
parent
b4d75f41f5
commit
43d0505bde
1 changed files with 4 additions and 1 deletions
|
@ -69,6 +69,8 @@ class Connection(_Connection):
|
|||
"""Connections to the device and sets the terminal type"""
|
||||
super(Connection, self)._connect()
|
||||
|
||||
display.debug('starting network_cli._connect()')
|
||||
|
||||
network_os = self._play_context.network_os
|
||||
if not network_os:
|
||||
for cls in terminal_loader.all(class_only=True):
|
||||
|
@ -94,7 +96,7 @@ class Connection(_Connection):
|
|||
if not self._terminal:
|
||||
raise AnsibleConnectionFailure('network os %s is not supported' % network_os)
|
||||
|
||||
return (0, 'connected', '')
|
||||
self._connected = True
|
||||
|
||||
@ensure_connect
|
||||
def open_shell(self):
|
||||
|
@ -115,6 +117,7 @@ class Connection(_Connection):
|
|||
display.vvv('closing connection', host=self._play_context.remote_addr)
|
||||
self.close_shell()
|
||||
super(Connection, self).close()
|
||||
self._connected = False
|
||||
|
||||
def close_shell(self):
|
||||
"""Closes the vty shell if the device supports multiplexing"""
|
||||
|
|
Loading…
Reference in a new issue