@@ -9,6 +9,7 @@ import re
9
9
from subprocess import Popen , STDOUT
10
10
import sys
11
11
12
+ # noinspection PyUnresolvedReferences
12
13
from six .moves import configparser
13
14
14
15
@@ -46,6 +47,18 @@ def call_updater(cfg, section, updater_script, log_dir, dry_run=False):
46
47
upstream_url = safe_get ("upstream_url" )
47
48
remote_user = safe_get ("remote_user" )
48
49
remote_dir = safe_get ("remote_dir" )
50
+ # Have default timeout be nonzero
51
+ if not cfg .has_section (section ) or not cfg .has_option (section , "timeout" ):
52
+ timeout = "3600"
53
+ else :
54
+ timeout = safe_get ("timeout" )
55
+ try :
56
+ if timeout :
57
+ timeout = int (timeout )
58
+ else :
59
+ timeout = 0
60
+ except ValueError as e :
61
+ raise Error ("%s: Invalid timeout %s" % (section , timeout ))
49
62
50
63
if not local_user :
51
64
raise Error ("%s: Missing required option local_user" % section )
@@ -64,6 +77,10 @@ def call_updater(cfg, section, updater_script, log_dir, dry_run=False):
64
77
if remote_dir :
65
78
cmd .append ("--remote-dir=%s" % remote_dir )
66
79
80
+ if timeout :
81
+ cmd .insert (0 , "timeout" )
82
+ cmd .insert (1 , str (timeout ))
83
+
67
84
if dry_run :
68
85
print ("Would run %r as %s" % (cmd , local_user ))
69
86
return
@@ -86,6 +103,11 @@ def call_updater(cfg, section, updater_script, log_dir, dry_run=False):
86
103
87
104
if returncode == 0 :
88
105
log .info ("Endpoint %s ok." , endpoint )
106
+ elif returncode == 124 :
107
+ raise Error (
108
+ "Endpoint %s TIMED OUT. See %s for details."
109
+ % (endpoint , log_file_path )
110
+ )
89
111
else :
90
112
raise Error (
91
113
"Endpoint %s FAILED with error %d. See %s for details."
0 commit comments