This is an automated email from the ASF dual-hosted git repository.

ofuks pushed a commit to branch multiple-cloud
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/multiple-cloud by this push:
     new 226b381  Fixed issues with libraries
226b381 is described below

commit 226b38157480aa2fe0b16504a5e80bee2fe381b9
Author: Oleh Fuks <olegfuk...@gmail.com>
AuthorDate: Wed Jan 15 17:18:23 2020 +0200

    Fixed issues with libraries
---
 .../dlab/backendapi/resources/LibraryResource.java | 23 ++++++++++++----------
 .../epam/dlab/backendapi/util/RequestBuilder.java  |  2 ++
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git 
a/services/provisioning-service/src/main/java/com/epam/dlab/backendapi/resources/LibraryResource.java
 
b/services/provisioning-service/src/main/java/com/epam/dlab/backendapi/resources/LibraryResource.java
index 28bf9ae..7d5810a 100644
--- 
a/services/provisioning-service/src/main/java/com/epam/dlab/backendapi/resources/LibraryResource.java
+++ 
b/services/provisioning-service/src/main/java/com/epam/dlab/backendapi/resources/LibraryResource.java
@@ -86,8 +86,7 @@ public class LibraryResource extends DockerService implements 
DockerCommands {
                String uuid = DockerCommands.generateUUID();
                folderListenerExecutor.start(configuration.getImagesDirectory(),
                                configuration.getResourceStatusPollTimeout(),
-                               getFileHandlerCallbackExploratory(action, uuid, 
dto, endpointService.getEndpointUrl(dto.getEndpoint()) +
-                                               ApiCallbacks.LIB_STATUS_URI));
+                               getFileHandlerCallbackExploratory(action, uuid, 
dto));
 
                RunDockerCommand runDockerCommand = 
getDockerCommandExploratory(dto, action, uuid);
 
@@ -100,8 +99,7 @@ public class LibraryResource extends DockerService 
implements DockerCommands {
                String uuid = DockerCommands.generateUUID();
                folderListenerExecutor.start(configuration.getImagesDirectory(),
                                configuration.getResourceStatusPollTimeout(),
-                               getFileHandlerCallbackComputational(action, 
uuid, dto, endpointService.getEndpointUrl(dto.getEndpoint()) +
-                                               ApiCallbacks.LIB_STATUS_URI));
+                               getFileHandlerCallbackComputational(action, 
uuid, dto));
 
                RunDockerCommand runDockerCommand = 
getDockerCommandComputational(dto, action, uuid);
 
@@ -156,28 +154,33 @@ public class LibraryResource extends DockerService 
implements DockerCommands {
        }
 
        private FileHandlerCallback 
getFileHandlerCallbackExploratory(DockerAction action, String uuid,
-                                                                               
                                                  ExploratoryBaseDTO<?> dto, 
String callbackUri) {
+                                                                               
                                                  ExploratoryBaseDTO<?> dto) {
+               String endpointUrl = 
endpointService.getEndpointUrl(dto.getEndpoint());
+
                switch (action) {
                        case LIB_LIST:
                                return new LibListCallbackHandler(selfService, 
DockerAction.LIB_LIST, uuid,
-                                               
dto.getCloudSettings().getIamUser(), dto.getNotebookImage(), callbackUri);
+                                               
dto.getCloudSettings().getIamUser(), dto.getNotebookImage(), endpointUrl +
+                                               ApiCallbacks.UPDATE_LIBS_URI);
                        case LIB_INSTALL:
                                return new 
LibInstallCallbackHandler(selfService, action, uuid, 
dto.getCloudSettings().getIamUser(),
-                                               (LibraryInstallDTO) dto, 
callbackUri);
+                                               (LibraryInstallDTO) dto, 
endpointUrl + ApiCallbacks.LIB_STATUS_URI);
                        default:
                                throw new IllegalArgumentException("Unknown 
action " + action);
                }
        }
 
        private FileHandlerCallback 
getFileHandlerCallbackComputational(DockerAction action, String uuid,
-                                                                               
                                                        ExploratoryBaseDTO<?> 
dto, String callbackUri) {
+                                                                               
                                                        ExploratoryBaseDTO<?> 
dto) {
+               String endpointUrl = 
endpointService.getEndpointUrl(dto.getEndpoint());
+
                switch (action) {
                        case LIB_LIST:
                                return new LibListCallbackHandler(selfService, 
action, uuid, dto.getCloudSettings().getIamUser(),
-                                               ((LibListComputationalDTO) 
dto).getLibCacheKey(), callbackUri);
+                                               ((LibListComputationalDTO) 
dto).getLibCacheKey(), endpointUrl + ApiCallbacks.UPDATE_LIBS_URI);
                        case LIB_INSTALL:
                                return new 
LibInstallCallbackHandler(selfService, action, uuid, 
dto.getCloudSettings().getIamUser(),
-                                               ((LibraryInstallDTO) dto), 
callbackUri);
+                                               ((LibraryInstallDTO) dto), 
endpointUrl + ApiCallbacks.LIB_STATUS_URI);
 
                        default:
                                throw new IllegalArgumentException("Unknown 
action " + action);
diff --git 
a/services/self-service/src/main/java/com/epam/dlab/backendapi/util/RequestBuilder.java
 
b/services/self-service/src/main/java/com/epam/dlab/backendapi/util/RequestBuilder.java
index bd67fab..bc43be9 100644
--- 
a/services/self-service/src/main/java/com/epam/dlab/backendapi/util/RequestBuilder.java
+++ 
b/services/self-service/src/main/java/com/epam/dlab/backendapi/util/RequestBuilder.java
@@ -272,6 +272,7 @@ public class RequestBuilder {
                                
.withNotebookInstanceName(userInstance.getExploratoryId())
                                
.withExploratoryName(userInstance.getExploratoryName())
                                .withProject(userInstance.getProject())
+                               .withEndpoint(endpointDTO.getName())
                                .withLibs(libs);
        }
 
@@ -299,6 +300,7 @@ public class RequestBuilder {
                                
.withComputationalName(computationalResource.getComputationalName())
                                
.withExploratoryName(userInstance.getExploratoryName())
                                .withProject(userInstance.getProject())
+                               .withEndpoint(endpointDTO.getName())
                                
.withComputationalImage(computationalResource.getImageName())
                                
.withApplicationName(getApplicationNameFromImage(userInstance.getImageName()))
                                .withLibs(libs);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org
For additional commands, e-mail: commits-h...@dlab.apache.org

Reply via email to