ssh: add timeout

Signed-off-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Ruslan Kuprieiev
2018-09-08 16:17:08 +03:00
parent d1931e3dc0
commit 0687c4e199
2 changed files with 6 additions and 1 deletions
+2
View File
@@ -134,6 +134,7 @@ class Config(object):
SECTION_REMOTE_USER = 'user'
SECTION_REMOTE_PORT = 'port'
SECTION_REMOTE_KEY_FILE = 'keyfile'
SECTION_REMOTE_TIMEOUT = 'timeout'
SECTION_REMOTE_SCHEMA = {
SECTION_REMOTE_URL: And(supported_url, error="Unsupported URL"),
Optional(SECTION_AWS_REGION): str,
@@ -145,6 +146,7 @@ class Config(object):
Optional(SECTION_REMOTE_USER): str,
Optional(SECTION_REMOTE_PORT): Use(int),
Optional(SECTION_REMOTE_KEY_FILE): str,
Optional(SECTION_REMOTE_TIMEOUT): Use(int),
}
SCHEMA = {
+4 -1
View File
@@ -47,6 +47,7 @@ class RemoteSSH(RemoteBase):
PARAM_MD5 = 'md5'
DEFAULT_PORT = 22
TIMEOUT = 1800
def __init__(self, project, config):
self.project = project
@@ -59,6 +60,7 @@ class RemoteSSH(RemoteBase):
self.prefix = self.group('path')
self.port = config.get(Config.SECTION_REMOTE_PORT, self.DEFAULT_PORT)
self.keyfile = config.get(Config.SECTION_REMOTE_KEY_FILE, None)
self.timeout= config.get(Config.SECTION_REMOTE_TIMEOUT, self.TIMEOUT)
def md5s_to_path_infos(self, md5s):
return [{'scheme': 'ssh',
@@ -81,7 +83,8 @@ class RemoteSSH(RemoteBase):
ssh.connect(host,
username=user,
port=port,
key_filename=self.keyfile)
key_filename=self.keyfile,
timeout=self.timeout)
return ssh