Skip to content
Snippets Groups Projects

Test

Merged Chris Hines requested to merge test into prod
1 file
+ 6
0
Compare changes
  • Side-by-side
  • Inline
@@ -56,8 +56,10 @@ class SSHSession:
import subprocess
import logging
logger = logging.getLogger()
self.lock.acquire()
if self.socket is None:
self.start_agent()
self.lock.release()
keyf = tempfile.NamedTemporaryFile(mode='w',delete=False)
keyname = keyf.name
keyf.write(key)
@@ -144,6 +146,7 @@ class SSHSession:
import signal
import logging
import time
self.lock.acquire()
logger=logging.getLogger()
logger.debug("shuting down ssh session for {} last seen at {}".format(self.authtok,self.last))
for pid in self.pids:
@@ -177,6 +180,7 @@ class SSHSession:
for tunnel in self.tunnels:
tunnel.kill()
(stdout, stderr) = tunnel.communicate()
self.lock.acquire()
@staticmethod
def test_sshsession(sess):
@@ -185,8 +189,10 @@ class SSHSession:
import logging
logger=logging.getLogger()
env = os.environ.copy()
sess.lock.acquire()
if sess.socket is None:
sess.start_agent()
sess.lock.release()
env['SSH_AUTH_SOCK'] = sess.socket
cmd = [sess.sshadd,'-l']
p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,env=env)
Loading