This is an automated email from the ASF dual-hosted git repository.
ykinash pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
The following commit(s) were added to refs/heads/develop by this push:
new 79af48b [DATALAB-2408] -- added response for properties restart
79af48b is described below
commit 79af48b9e2be8ed80931282d2d241f320ee9270f
Author: KinashYurii <[email protected]>
AuthorDate: Mon Jun 14 17:41:46 2021 +0300
[DATALAB-2408] -- added response for properties restart
---
.../epam/datalab/properties/ChangePropertiesService.java | 12 +++++++++++-
.../epam/datalab/properties/ExternalChangeProperties.java | 6 +++---
.../java/com/epam/datalab/properties/RestartAnswer.java | 13 +++++++++++++
.../backendapi/resources/ChangePropertiesResource.java | 4 ++--
4 files changed, 29 insertions(+), 6 deletions(-)
diff --git
a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java
index 36d9cf9..bbedce0 100644
---
a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java
+++
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ChangePropertiesService.java
@@ -66,7 +66,7 @@ public class ChangePropertiesService {
}
}
- public void restart(RestartForm restartForm) {
+ public RestartAnswer restart(RestartForm restartForm) {
try {
boolean billing = restartForm.isBilling();
boolean provserv = restartForm.isProvserv();
@@ -75,8 +75,18 @@ public class ChangePropertiesService {
log.info("Tying to restart ui: {}, provserv: {}, billing: {}, with
command: {}", ui,
provserv, billing, shCommand);
Runtime.getRuntime().exec(shCommand).waitFor();
+ return RestartAnswer.builder()
+ .billingSuccess(billing)
+ .provservSuccess(provserv)
+ .endpoint(restartForm.getEndpoint())
+ .build();
} catch (IOException | InterruptedException e) {
log.error(e.getMessage());
+ return RestartAnswer.builder()
+ .billingSuccess(false)
+ .provservSuccess(false)
+ .endpoint(restartForm.getEndpoint())
+ .build();
}
}
diff --git
a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ExternalChangeProperties.java
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ExternalChangeProperties.java
index 7debcae..d05c528 100644
---
a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ExternalChangeProperties.java
+++
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/ExternalChangeProperties.java
@@ -85,12 +85,12 @@ public class ExternalChangeProperties implements
ChangePropertiesConst {
}
- public void restartForExternal(RestartForm restartForm, UserInfo userInfo,
String url) {
+ public RestartAnswer restartForExternal(RestartForm restartForm, UserInfo
userInfo, String url) {
if (restartForm.getEndpoint().equals(LOCAL_ENDPOINT_NAME)) {
- changePropertiesService.restart(restartForm);
+ return changePropertiesService.restart(restartForm);
} else {
log.info("External request for endpoint {}, for user {}",
restartForm.getEndpoint(), userInfo.getSimpleName());
- provService.post(url, userInfo.getAccessToken(), restartForm,
Void.class);
+ return provService.post(url, userInfo.getAccessToken(),
restartForm, RestartAnswer.class);
}
}
diff --git
a/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/RestartAnswer.java
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/RestartAnswer.java
new file mode 100644
index 0000000..9dfea10
--- /dev/null
+++
b/services/datalab-webapp-common/src/main/java/com/epam/datalab/properties/RestartAnswer.java
@@ -0,0 +1,13 @@
+package com.epam.datalab.properties;
+
+import lombok.Builder;
+import lombok.Data;
+
+@Data
+@Builder
+public class RestartAnswer {
+
+ private boolean billingSuccess;
+ private boolean provservSuccess;
+ private String endpoint;
+}
diff --git
a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
index 73ccb3c..e9ad2bf 100644
---
a/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
+++
b/services/provisioning-service/src/main/java/com/epam/datalab/backendapi/resources/ChangePropertiesResource.java
@@ -85,7 +85,7 @@ public class ChangePropertiesResource implements
ChangePropertiesConst {
@POST
@Path("/restart")
public Response restart(@Auth UserInfo userInfo, RestartForm restartForm) {
- changePropertiesService.restart(restartForm);
- return Response.ok().build();
+ return Response.ok(changePropertiesService.restart(restartForm))
+ .build();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]