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()pull/4420/head
parent
b4d75f41f5
commit
43d0505bde
|
@ -69,6 +69,8 @@ class Connection(_Connection):
|
||||||
"""Connections to the device and sets the terminal type"""
|
"""Connections to the device and sets the terminal type"""
|
||||||
super(Connection, self)._connect()
|
super(Connection, self)._connect()
|
||||||
|
|
||||||
|
display.debug('starting network_cli._connect()')
|
||||||
|
|
||||||
network_os = self._play_context.network_os
|
network_os = self._play_context.network_os
|
||||||
if not network_os:
|
if not network_os:
|
||||||
for cls in terminal_loader.all(class_only=True):
|
for cls in terminal_loader.all(class_only=True):
|
||||||
|
@ -94,7 +96,7 @@ class Connection(_Connection):
|
||||||
if not self._terminal:
|
if not self._terminal:
|
||||||
raise AnsibleConnectionFailure('network os %s is not supported' % network_os)
|
raise AnsibleConnectionFailure('network os %s is not supported' % network_os)
|
||||||
|
|
||||||
return (0, 'connected', '')
|
self._connected = True
|
||||||
|
|
||||||
@ensure_connect
|
@ensure_connect
|
||||||
def open_shell(self):
|
def open_shell(self):
|
||||||
|
@ -115,6 +117,7 @@ class Connection(_Connection):
|
||||||
display.vvv('closing connection', host=self._play_context.remote_addr)
|
display.vvv('closing connection', host=self._play_context.remote_addr)
|
||||||
self.close_shell()
|
self.close_shell()
|
||||||
super(Connection, self).close()
|
super(Connection, self).close()
|
||||||
|
self._connected = False
|
||||||
|
|
||||||
def close_shell(self):
|
def close_shell(self):
|
||||||
"""Closes the vty shell if the device supports multiplexing"""
|
"""Closes the vty shell if the device supports multiplexing"""
|
||||||
|
|
Loading…
Reference in New Issue