File tree Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Expand file tree Collapse file tree 4 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 7
7
* A "local run" mode for debugging/development
8
8
* Make proxy start without explicit configuration
9
9
* Get rid of multirun
10
- * Propagate errors from ` run_faaso ` to the remote client
10
+ * ✅ Propagate errors from ` run_faaso ` to the remote client
11
11
* Setting up hostname for Caddy's automatic HTTPS
12
12
* Config UI in frontend?
13
13
* Add multi-container logs to web frontend. It's close but
Original file line number Diff line number Diff line change 2
2
password : adminfoo
3
3
scale :
4
4
builder : 0
5
- busqueda : 0
5
+ busqueda : 2
6
6
foo : 0
7
7
fufu : 0
8
8
historico : 3
Original file line number Diff line number Diff line change @@ -121,7 +121,11 @@ module Funko
121
121
122
122
post " /rpc/" do |env |
123
123
args = env.params.json[" args" ].as(Array ).map & .to_s
124
- run_faaso(args, env)
124
+ begin
125
+ run_faaso(args, env)
126
+ rescue ex : Exception
127
+ halt env, status_code: 500 , response: " Error"
128
+ end
125
129
Config .reload
126
130
Config .instance.save
127
131
end
@@ -143,7 +147,9 @@ module Funko
143
147
break if process.terminated?
144
148
end
145
149
end
146
- # FIXME: find a way to raise an exception on failure
147
- # of the faaso process
150
+ # Because headers are already sent we need to send the
151
+ # error condition in-band
152
+ env.response.print(" \n ##--##--##--##ERROR" ) if $? .exit_code != 0
153
+ env.response.flush
148
154
end
149
155
end
Original file line number Diff line number Diff line change @@ -32,13 +32,21 @@ module Faaso
32
32
33
33
def self.rpc_call (args : Array (String )) : Int32
34
34
user, password = Config .auth
35
+ buf = IO ::Memory .new
35
36
Crest .post(
36
37
" #{ Config .server} rpc/" ,
37
38
{" args" => args},
38
39
user: user, password: password,
39
40
json: true ) do |response |
40
- IO .copy(response.body_io, STDOUT )
41
+ IO .copy(response.body_io, buf)
42
+ buf.seek(0 )
43
+ IO .copy(buf, STDOUT )
44
+ end
45
+ if buf.to_s.ends_with? " \n ##--##--##--##ERROR"
46
+ Log .error { " \n Server returned an error" }
47
+ 1
48
+ else
49
+ 0
41
50
end
42
- 0
43
51
end
44
52
end
You can’t perform that action at this time.
0 commit comments