-
Notifications
You must be signed in to change notification settings - Fork 1.1k
com.github.dockerjava.api.model.PullResponseItem#isPullSuccessIndicated fails to check for "Exists" status #2010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Quick fix was to create this class in my test classpath: package com.github.dockerjava.api.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Represents a pull response stream item
*/
public class PullResponseItem extends com.github.dockerjava.api.model.ResponseItem {
private static final long serialVersionUID = -2575482839766823293L;
private static final String LEGACY_REGISTRY = "this image was pulled from a legacy registry";
private static final String DOWNLOADED_NEWER_IMAGE = "Downloaded newer image";
private static final String IMAGE_UP_TO_DATE = "Image is up to date";
private static final String DOWNLOAD_COMPLETE = "Download complete";
private static final String DOWNLOADED_SWARM = ": downloaded";
private static final String EXISTS = "Exists";
/**
* Returns whether the status indicates a successful pull operation
*
* @returns true: status indicates that pull was successful, false: status doesn't indicate a successful pull
*/
@JsonIgnore
public boolean isPullSuccessIndicated() {
if (isErrorIndicated() || getStatus() == null) {
return false;
}
return (
getStatus().contains(DOWNLOAD_COMPLETE)
|| getStatus().contains(IMAGE_UP_TO_DATE)
|| getStatus().contains(DOWNLOADED_NEWER_IMAGE)
|| getStatus().contains(LEGACY_REGISTRY)
|| getStatus().contains(DOWNLOADED_SWARM)
|| getStatus().contains(EXISTS));
}
} |
@eddumelendez Sorry for the late reply. On Win at least, it is "Exists" - However, I'm currently using the above workaround in all our projects, which are also built on ios and ubuntu based systems. |
@eddumelendez another workaround is of course to delete the image, but that's kind of drastic ;-) - Interestingly the IMAGE_UP_TO_DATE is not the status here, which is what I'd expect given that the image is actually up to date. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
com.github.dockerjava.api.model.PullResponseItem#isPullSuccessIndicated checks for several success states, but misses "Exists" and treats this status as a failure.
Caused by: com.github.dockerjava.api.exception.DockerClientException: Could not pull image: Exists
If would be great if the success status codes could be a configurable list that the library user could append to.
The text was updated successfully, but these errors were encountered: