private void handleDockerSwarmResponse(final PullResponseItem item) { if (results == null) { results = new HashMap<>(); } // Swarm terminates a pull sometimes with an empty line. // Therefore keep first success message PullResponseItem currentItem = results.get(item.getId()); if (currentItem == null || !currentItem.isPullSuccessIndicated()) { results.put(item.getId(), item); } }
private void checkDockerSwarmPullSuccessful() { if (results.isEmpty()) { throw new DockerClientException("Could not pull image through Docker Swarm"); } else { boolean pullFailed = false; StringBuilder sb = new StringBuilder(); for (PullResponseItem pullResponseItem : results.values()) { if (!pullResponseItem.isPullSuccessIndicated()) { pullFailed = true; sb.append("[" + pullResponseItem.getId() + ":" + messageFromPullResult(pullResponseItem) + "]"); } } if (pullFailed) { throw new DockerClientException("Could not pull image: " + sb.toString()); } } }
private void handleDockerSwarmResponse(final PullResponseItem item) { if (results == null) { results = new HashMap<>(); } // Swarm terminates a pull sometimes with an empty line. // Therefore keep first success message PullResponseItem currentItem = results.get(item.getId()); if (currentItem == null || !currentItem.isPullSuccessIndicated()) { results.put(item.getId(), item); } }
private void checkDockerSwarmPullSuccessful() { if (results.isEmpty()) { throw new DockerClientException("Could not pull image through Docker Swarm"); } else { boolean pullFailed = false; StringBuilder sb = new StringBuilder(); for (PullResponseItem pullResponseItem : results.values()) { if (!pullResponseItem.isPullSuccessIndicated()) { pullFailed = true; sb.append("[" + pullResponseItem.getId() + ":" + messageFromPullResult(pullResponseItem) + "]"); } } if (pullFailed) { throw new DockerClientException("Could not pull image: " + sb.toString()); } } }
private ItemStatus createStatusItem(PullResponseItem item, ItemStatus previousStatus) { ProgressDetail progressDetail = item.getProgressDetail(); if (progressDetail != null && progressDetail.getTotal() != null && progressDetail.getTotal() > 0) { int currentPct = computePercentage(previousStatus, progressDetail); return ItemStatus.builder() .id(item.getId()) .percentage(currentPct) .pullStatus(statusNotNull(item.getStatus())? item.getStatus() : "") .build(); } return ItemStatus.builder() .id(item.getId()) .percentage(0) .pullStatus(statusNotNull(item.getStatus())? item.getStatus() : "") .build(); }