Commit 325bbd98 authored by Antoine Catton's avatar Antoine Catton

Add timeout on ssh rdiff-backup promise.

parent 1505c512
...@@ -30,6 +30,7 @@ from urlparse import urlparse ...@@ -30,6 +30,7 @@ from urlparse import urlparse
import os import os
import subprocess import subprocess
import sys import sys
import time
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
from slapos.recipe.dropbear import KnownHostsFile from slapos.recipe.dropbear import KnownHostsFile
...@@ -53,6 +54,10 @@ def promise(args): ...@@ -53,6 +54,10 @@ def promise(args):
ssh.stdin.flush() ssh.stdin.flush()
ssh.stdin.close() ssh.stdin.close()
time.sleep(2)
if ssh.poll() is None:
ssh.kill()
if ssh.wait() != 0: if ssh.wait() != 0:
# Bad python 2 syntax, looking forward python 3 to have print(file=) # Bad python 2 syntax, looking forward python 3 to have print(file=)
print >> sys.stderr, "SSH Connection failed" print >> sys.stderr, "SSH Connection failed"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment