File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed
platform-api/src/main/java/com/flow/platform/api/service
platform-control-center/src/main/java/com/flow/platform/cc/service Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -177,8 +177,7 @@ public void delete(AgentPath agentPath){
177177 HttpClient .build (platformURL .getAgentDeleteUrl ())
178178 .post (agent .toJson ())
179179 .withContentType (ContentType .APPLICATION_JSON )
180- .retry (httpRetryTimes )
181- .bodyAsString ().getBody ();
180+ .retry (httpRetryTimes );
182181
183182 } catch (UnsupportedEncodingException e ) {
184183 throw new IllegalStatusException (e .getMessage ());
@@ -194,15 +193,17 @@ private String buildAgentWebhook() {
194193 */
195194 private Agent findAgent (AgentPath agentPath ){
196195 String url = platformURL .getAgentFindUrl () + "?" + "zone=" + agentPath .getZone () + "&" + "name=" + agentPath .getName ();
197- String res = HttpClient .build (url )
196+ HttpResponse < String > response = HttpClient .build (url )
198197 .get ()
199198 .retry (httpRetryTimes )
200- .bodyAsString (). getBody () ;
199+ .bodyAsString ();
201200
202- if (Strings . isNullOrEmpty ( res )) {
201+ if (! response . hasSuccess ( )) {
203202 throw new HttpException ("Unable to delete agent" );
204203 }
205- Agent agent = Agent .parse (res , Agent .class );
204+
205+ Agent agent = Agent .parse (response .getBody (), Agent .class );
206+
206207 if (agent .getStatus () == AgentStatus .BUSY ){
207208 throw new IllegalStatusException ("agent is busy, please wait" );
208209 }
Original file line number Diff line number Diff line change 3535import com .flow .platform .util .Logger ;
3636import com .google .common .base .Strings ;
3737import com .google .gson .annotations .Expose ;
38+ import java .sql .SQLDataException ;
3839import java .time .ZonedDateTime ;
3940import java .time .temporal .ChronoUnit ;
4041import java .util .Collection ;
@@ -227,6 +228,11 @@ public AgentSettings settings(String token) {
227228
228229 @ Override
229230 public void delete (Agent agent ){
230- agentDao .delete (agent );
231+ try {
232+ agentDao .delete (agent );
233+ } catch (Throwable e ){
234+ throw new UnsupportedOperationException ("delete agent failure " + e .getMessage ());
235+ }
236+
231237 }
232238}
You can’t perform that action at this time.
0 commit comments