connection: use close from superclass

We had our own re-implemented close function from when this was
first introduced which has since then drifted a lot from Ansible.

This drops all that code so that we can use the superclass when
closing the connection.

Change-Id: Id62e510af035988084453883278c3db85c8b7519
This commit is contained in:
Mohammed Naser 2019-06-03 19:00:54 -04:00
parent e085907160
commit 74ae653e2f
1 changed files with 0 additions and 12 deletions

View File

@ -551,15 +551,3 @@ class Connection(SSH.Connection):
self.container_user = 'root'
self.exec_command('chown %s %s' % (_user, out_path))
self.container_user = _user
def close(self):
# If we have a persistent ssh connection (ControlPersist), we can ask it
# to stop listening. Otherwise, there's nothing to do here.
if self._connected and self._persistent:
cmd = self._build_command('ssh', '-O', 'stop', self.host)
cmd = map(SSH.to_bytes, cmd)
p = SSH.subprocess.Popen(cmd,
stdin=SSH.subprocess.PIPE,
stdout=SSH.subprocess.PIPE,
stderr=SSH.subprocess.PIPE)
p.communicate()