Skip to content

Commit

Permalink
[grid] Saving capabilities from the end point response [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
diemol committed Nov 15, 2020
1 parent b1beaa0 commit a9a4371
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ public Optional<ActiveSession> apply(CreateSessionRequest sessionRequest) {
SessionId id = new SessionId(response.getSessionId());
Capabilities capabilities = new ImmutableCapabilities((Map<?, ?>) response.getValue());
Container videoContainer = null;
if (isVideoRecordingAvailable && recordVideoForSession(sessionRequest.getCapabilities())) {
if (isVideoRecordingAvailable && recordVideoForSession(capabilities)) {
Map<String, String> envVars = getVideoContainerEnvVars(
sessionRequest.getCapabilities(),
capabilities,
containerInfo.getIp());
Optional<Path> sessionAssetsPath = createSessionAssetsPath(assetsPath, id);
if (sessionAssetsPath.isPresent()) {
Map<String, String> volumeBinds =
Collections.singletonMap(sessionAssetsPath.get().toString(), "/videos");
saveSessionCapabilities(sessionRequest.getCapabilities(), sessionAssetsPath.get());
saveSessionCapabilities(capabilities, sessionAssetsPath.get());
videoContainer = docker.create(image(videoImage).env(envVars).bind(volumeBinds));
videoContainer.start();
LOG.info(String.format("Video container started (id: %s)", videoContainer.getId()));
Expand Down Expand Up @@ -332,11 +332,11 @@ private void saveSessionCapabilities(Capabilities sessionRequestCapabilities, Pa
String capsToJson = new Json().toJson(sessionRequestCapabilities);
try {
Files.write(
Paths.get(assetsPath.toString(), "metadata.json"),
Paths.get(assetsPath.toString(), "sessionCapabilities.json"),
capsToJson.getBytes(Charset.defaultCharset()));
} catch (IOException e) {
LOG.log(Level.WARNING,
"Failed to save session capabilities as metadata", e);
"Failed to save session capabilities", e);
}
}

Expand Down

0 comments on commit a9a4371

Please sign in to comment.