Skip to content
Snippets Groups Projects
Commit 44b4d4aa authored by Chris Hines's avatar Chris Hines
Browse files

I think I found the lock error

parent 5b7f4c31
No related branches found
No related tags found
2 merge requests!97Test,!96Dev
Pipeline #70108 passed
......@@ -98,8 +98,10 @@ class Ssh:
@staticmethod
def check_ctrlsocket(sess, ctrlsocket):
cmd = ['ssh','-S',ctrlsocket,'-O','check','-l','noone','nohost']
check_p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=None)
(stderr,stdout) = check_p.communicate(timeout=Ssh.TIMEOUT)
try:
check_p = subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,stdin=None)
(stderr,stdout) = check_p.communicate(timeout=Ssh.TIMEOUT)
return check_p.returncode == 0
@staticmethod
......@@ -115,9 +117,14 @@ class Ssh:
logger.debug("enter get_ctrl_master_socket")
ctrlsocket = "/tmp/cm-{}-{}-{}".format(user,host,sess.sshsessid)
sess.lock.acquire()
if Ssh.check_ctrlsocket(sess,ctrlsocket):
try:
if Ssh.check_ctrlsocket(sess,ctrlsocket):
sess.lock.release()
return ctrlsocket
except subprocess.TimeoutExpired as e:
sess.lock.release()
return ctrlsocket
raise e
try:
mode = os.stat(ctrlsocket).st_mode
logger.debug('removing stale control socket')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment